more koans but im drunk

This commit is contained in:
Steven Degutis
2012-03-15 22:09:25 -05:00
parent 57c728b4ba
commit 0aca59270b

View File

@@ -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
}
}