Skip to content

Instantly share code, notes, and snippets.

@coopermayne
Last active August 29, 2015 14:25
Show Gist options
  • Save coopermayne/6afd71fb49f0464def9f to your computer and use it in GitHub Desktop.
Save coopermayne/6afd71fb49f0464def9f to your computer and use it in GitHub Desktop.
homework
#EXERCISES
##while while while
first let's do some stuff with while loops and counters
####one
make a while loop that runs 3 times -- printing some text each time -- then stops running. (you'll need to use a counter)
####two
make a password program using while loops -- if the user gets the password correct, exit the while loop and tell them they got it... if the user gets the password incorrect 3 times exit the loop and tell them they got it wrong.
##find max and min
write code that will ask for a bunch of numbers from the user (remember to chomp and to_i). save the numbers to an array. after the program gets a bunch of numbers. print out a line that tells the user the biggest number and smallest number in the array. (you'll need to use each and if and "<<" for this problem). [[tip: get the program working with an set array like *numbers = [4,2,10,3]* first... once that is working you can do the user input part.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment