while (true) {
//your code
}
// Infinite loop with the terminating condition set to infinity
for (var i = 0; i < Infinity; i++) {
// statements
}
// Also you can try
for (;;) {
// statements
}
for (var i=0; i<Infinity; i++) {}
// infinite while loop
while(true){
// body of loop
}
var i = 1;
var sum = 0;
while(i < 5) {
sum += i;
}
println(sum);