Last active
December 16, 2015 05:29
-
-
Save gulnara/5384900 to your computer and use it in GitHub Desktop.
simple guessing game in my language
This file contains 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
#assignment is done via <-, equality is id with only one = | |
prompt <- '>' | |
#printing is done via show | |
show 'What's your name?' | |
#the input from user is taken via user_input = raw_input in python | |
name <- user_input using prompt | |
#any variable that is referenced in the string will be referenced via %var and outside the string it will be rerenced via % and the name of the variable | |
show 'Hello' name | |
show 'Let's play a game! Pick any number between 1 and 20.' | |
# randomize is a method - haven't figured out how to implement yet | |
i <- randomize using 1 to 20 | |
#loops have names and in order to break out of a loop you use stop + the name of then loop | |
# the insides of the loop have to be indented | |
loop guessing: | |
stratting with | |
initial guess <- 0 | |
end | |
guess <- guess + 1 | |
number <- number_input via prompt | |
#conditinal statements are defined via ?, then, default: | |
is number < i ? | |
then show 'The number is too low. Try again.' | |
or is number > i ? | |
then show 'The number is too high. Try again.' | |
otherwise | |
show 'You guessed it! Great job' name 'You found my number in' guess 'tries.' | |
stop guessing | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment