Delete dead file, add block stmt
This commit is contained in:
parent
7715adfebc
commit
6378b101bf
2 changed files with 9 additions and 44 deletions
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
Nimrod many different control flow constructs, including the standard `if`s, `else`s, and `while`s.
|
||||
|
||||
When inside a loop or block, it is possible to use `continue` or `break` any point, where `continue` skips to the next iteration and `break` ends the loop. The break statement can also receive the name of the block to break out of, so it is possible to break out of nested loops.
|
||||
|
||||
``` Nimrod
|
||||
import strutils
|
||||
|
||||
let
|
||||
answer = 4 # Chosen by a fair dice roll,
|
||||
# guaranteed to be random
|
||||
|
||||
let answer = 4 # Chosen by a fair dice roll,
|
||||
# guaranteed to be random
|
||||
while true:
|
||||
echo "I have a number from 1 to 10, what is it? "
|
||||
let guess = parseInt(stdin.readLine)
|
||||
|
|
@ -20,6 +20,9 @@ while true:
|
|||
else:
|
||||
echo "Correct!"
|
||||
break
|
||||
```
|
||||
|
||||
When inside a loop, it is possible to use `continue` or `break` any point within the loop with the standard semantics, where `continue` skips to the next iteration and `break` ends the loop.
|
||||
block busyloops:
|
||||
while true:
|
||||
while true:
|
||||
break busyloops
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue