Skip to content

Control Flow

If / Else

wyn
var score = 85

if score >= 90 {
    println("A grade")
} else if score >= 80 {
    println("B grade")
} else {
    println("Try harder")
}

For Loops

Range

wyn
for i in 0..5 {
    println("Count: ${i}")
}

Over Arrays

wyn
var fruits = ["apple", "banana", "orange"]
for fruit in fruits {
    println("Fruit: ${fruit}")
}

While Loops

wyn
var count = 0
while count < 3 {
    println("Count: ${count}")
    count = count + 1
}

Break and Continue

wyn
for i in 0..100 {
    if i == 5 { break }
    if i % 2 == 0 { continue }
    println(i.to_string())
}

Try It

🐉 Playground
Press Run or Ctrl+Enter

MIT License