Created
March 5, 2018 15:18
-
-
Save trickster/d2cc8227d2fc4974f9c79eb219734647 to your computer and use it in GitHub Desktop.
control flow in Nim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import strutils, random | |
randomize() | |
let answer = rand(10) | |
while true: | |
echo "Guess the number?" | |
let guess = parseInt(stdin.readLine) | |
if guess < answer: | |
echo "Less than answer" | |
elif guess > answer: | |
echo "Too high" | |
else: | |
echo "Correct" | |
break | |
block busyloops: | |
while true: | |
while true: | |
echo "Inside busyloops" | |
break busyloops |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment