Skip to content

Instantly share code, notes, and snippets.

/ruby.rb Secret

Created September 6, 2015 03:47
Show Gist options
  • Save anonymous/60bfff07c80f4f4f1c5f to your computer and use it in GitHub Desktop.
Save anonymous/60bfff07c80f4f4f1c5f to your computer and use it in GitHub Desktop.
# Functions
def getGuess()
guess = gets.chomp;
x = guess;
end
# Variables
remainingGuesses = 10;
# Main Program
puts ("I'm thinking of a number between 1 and 100. You have " + remainingGuesses.to_s + " guesses remaining.")
print (">> ");
getGuess();
while (x < 2)
puts ("Too low. Guess again.");
remainingGuesses -= 1;
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment