While loop

var count: Int = 0

while count < 10
{
 print(count)
 count += 1
}

repeat while loop

repeat
{
 print("hello")
 count += 1
} while count < 10

Notes
- repeat while is similar to do while
- it performs the function at least once, and performs it first

Comments

Popular posts from this blog

Setting up a playground

Go to another page