How to make a loop that loops 5 times then moves on??

How to make a loop that loops 5 times then moves on?? kinda need help asap thanks for helping:)

I might use a For loop:
http://arduino.cc/en/Reference/For

mrdove500:
o yes i am 13 so i am noobD: i have been doing java for about 6 months now^_^ and i still suck

You'll find that a lot of Java constructs are similar to C/C++.

Keep practicing.

wait is the programing of mega2560 in java? or c#?

C++

mrdove500:
How to make a loop that loops 5 times then moves on?? kinda need help asap thanks for helping:)

could be the wrong approach as im into this about 6 months as well. but...

how about a 'while' statement

maybe something like this:

while (something)
      {
        do something;
        count++;

          if(count == 5){
             break;
             count = 0;
             }

       }

edit:
ha... so i just went and looked at the link i posted. and it has exactly what you want. i guess ignore my example

While can work, as can "do ... while". Good exercise: try 'em all! One note, in your example, the statement count = 0 is never reached.

Here's a more concise construct, give it a try. Change "count++" to "++count" and note the difference.

void setup(void)
{
    int count = 0;
    
    Serial.begin(115200);
    
    while (count++ < 5) {
        Serial.println(count, DEC);
    }
}

void loop(void)
{
}

so this is not javaD:

mrdove500:
so this is not javaD:

Correct, not Java. C/C++.

what can you do more stuff with over all java or c++ cuase i am new with java and i think it is aboring but is c++ the same?

mrdove500:
what can you do more stuff with over all java or c++ cuase i am new with java and i think it is aboring but is c++ the same?

Java is a 'portable' language. The program gets compiled into 'byte code' and then an interpreter program plays the part of the computer to execute the 'byte code'. You can run the same Java byte code on any computer that has a Java interpreter.

C and C++ (the Object Oriented version of C) are generally compiled directly to 'machine code' and the resulting program is executed directly by the processor. This means that the compiled code is not portable but it is generally faster and often smaller.

As you learn more programming languages you will find things that are similar among many and features that are unique to each.

what would you wather use java or c++?

mrdove500:
what would you wather use java or c++?

All languages have their strengths and weaknesses depending on the task or problem to be solved. If you really want to become an excellent programmer, stop looking at languages in terms of "which is the best", and start looking at them in terms of "which is best to solve the problem at hand". Furthermore, become intimately familiar with the basic underlying constructs of modern languages; they all share a few basic structures (most of which can be traced back to K&R and the C language). Lastly, become familiar, if not expert, in the history of computing and computation (it is really fascinating, and there is a ton to be learned by studying it).