more koans but im drunk
This commit is contained in:
@@ -47,6 +47,25 @@ func testControlFlow() {
|
||||
case true:
|
||||
str = "second"
|
||||
}
|
||||
assert(str == "second") // in the absence of value, truth is assumed
|
||||
assert(str == "second") // in the absence of value, there is truth
|
||||
}
|
||||
|
||||
{
|
||||
n := 0
|
||||
for i := 0; i < 5; i++ {
|
||||
n += i
|
||||
}
|
||||
assert(n == 10) // for can have the structure with which we are all familiar
|
||||
}
|
||||
|
||||
{
|
||||
n := 1
|
||||
for {
|
||||
n *= 2
|
||||
if n > 20 {
|
||||
break
|
||||
}
|
||||
}
|
||||
assert(n == 32) // though omitting everything creates an infinite loop
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user