Reputation: 23
I finally got around to learning java after continuously bashing it as a python elitist lol. All jokes aside, I'm looking forward to playing with java and already having some fun with it.
I couldn't seem to find a simple solution for my problem. Basically, I want to make a for loop that will repeat itself a specific amount of times similar to this as in python:
for i in range(10):
Print("You win")
but for java of course.
I tried the following after some digging on the internet:
for (int i : new Range(10)) {
System.out.println("You win");
}
The following code gave me an error saying:
Range cannot be resolved to a type
Any help would be appreciated.
Upvotes: 0
Views: 49
Reputation: 1496
A simple for loop would do the trick:
for(int i = 0 ; i < 10; i++){
System.out.println("you win");
}
Upvotes: 1