nested loop(){} functions

Hello.

I want to use a loop(n) function so it loops something n number of times.

My program has two main subs. One sub is triggered by a timer1, another one is a big loop.
Inside this loop I want something to happen n number of times, depending on what value n gets.

For some reason I get syntax errors when I put loop() inside main void loop() function.
Can I nest loops?
Do loops only accept char as a value?

Do I cast variables but placing (int)charvar1 or (float)intvar1?
Do I have to use a special algorithm of rounding to convert int to char?

Thank you.

Can't you use a for loop and use your (n)? for(int index = 0; index < n; index++)

I want to use a loop(n) function

The loop function has a special meaning to the Arduino environment. Use a different name.

Can I nest loops?

You can't nest functions.

Do loops only accept char as a value?

No

To do something n times, use a for loop.

Pete

My program has two main subs.

What program?

Looks like loop() is a "special" function that I must work around.

I wish Arduino developers would make a change in future versions of the Arduino compiler and differentiate loop() and loop(n) with a variable in the parentheses.

I wish Arduino developers would make a change in future versions of the Arduino compiler and differentiate loop() and loop(n) with a variable in the parentheses.

Ain't going to happen. There is nothing magic about the name. Use something that means something in your application.

loop() does just what the name say it call and once the function finishes it call again!

Mark

loop() does not perform any magical function of looping. It just happens to be a function that is called over and over again inside a looping program structure elsewhere. The actual keywords that CAUSE looping are "while", "do ... while", and "for"

Post your code.