Watch This Video
---------------------------------------------------------------------------------------------------------//Looping
//while
List numbers=[1,2,3]
while(numbers)
{
//do something
numbers.remove(0)
}
assert numbers ==[]
//for
List nums=[1,2,3,4]
for(Integer i in 1..10){
println i
}
for(j in 1..5)
{
println j
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.