Skip to content

Instantly share code, notes, and snippets.

@trickster
Created March 5, 2018 15:18
Show Gist options
  • Save trickster/d2cc8227d2fc4974f9c79eb219734647 to your computer and use it in GitHub Desktop.
Save trickster/d2cc8227d2fc4974f9c79eb219734647 to your computer and use it in GitHub Desktop.
control flow in Nim
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