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
# Is it customary to start variable counts at one? (ie. noun1) or | |
# at zero (ie. noun and the second being noun1) or how else is this | |
# handled? | |
print( 'Enter an adjective: ' ) | |
adjective1 = gets.chomp() | |
print( 'Enter a verb ending in "ed": ') | |
verbEd = gets.chomp() | |
print( 'Enter a plural noun: ') | |
pluralNoun1 = gets.chomp() |
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
# Try to figure out if there is a way to chomp & convert to an integer on | |
# same line (lines 7 and 8) | |
# Try to figure out how to print failure message (lines 14-16 & 20-22) for | |
# both cases in which the user is incorrect without having it in the program | |
# twice. | |
randNumber = rand(10) | |
randNumber = randNumber + 1 | |
print( 'Guess my number! Enter a number (1-10): ') | |
userNumber = gets.chomp.to_i() |
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
puts( ' <(^.^)> LITTLE KNOWN FACTS O\' MELANIE <(^.^)>') | |
puts | |
puts( 'To play, select the letter that corresponds with your answer | |
then press return') | |
answer = '' | |
while answer != 'c' | |
puts( '#1 Gym class sux. How would Melanie get out of running laps in Elem school?') | |
puts | |
puts( 'a. She got a doctors note') |
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
lottery1 = rand(10) | |
lottery2 = rand(10) | |
lottery3 = rand(10) | |
pick1 = 10 | |
pick2 = 10 | |
pick3 = 10 | |
numberMatch = 0 |
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
words = ['rocks', 'giraffes', 'nilla', 'dinosaur'] | |
puts 'Need input! Input:' | |
input = gets.chomp | |
found = false | |
words.each do |i| | |
if input == i | |
found = true | |
end |
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
Shoes.app do | |
para "Which is best?\n" | |
flow do | |
@cats = button "Cats" | |
@giraffes = button "Giraffes" | |
@rocks = button "Rocks" | |
end | |
@cats.click { image "http://icanhascheezburger.files.wordpress.com/2010/05/funny-pictures-cats-are-adrift.jpg" } |
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
cats = ['Chip', 'Nilla'] | |
cats.push 'Mel the Cat' | |
answer = '' | |
puts 'KITTY CAT XMAS LIST MAKER' | |
puts 'Did you get any new cats this year?' | |
answer = gets.chomp.downcase | |
while answer == 'yes' | |
puts 'You got a new kitty!?! Name it:' | |
kitten = gets.chomp |
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
words = [] | |
puts 'I am The Sorter! Enter many words. Hit enter after each word. When you | |
are done entering words, hit enter on an empty line.' | |
input = gets.chomp | |
words.push input | |
while input != '' | |
input = gets.chomp |
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
def hug | |
puts 'Wraps arms around' | |
end | |
def cookies | |
puts 'bakes cookies' | |
end | |
def massage | |
puts 'rubs back' |
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
#A lethal dose of Aspirin is 500 mg/kg of body weight. | |
# 1kg = 2.2 pounds. | |
# 325 mg tablets. | |
puts 'What is your weight in pounds?' | |
weight_in_pounds = gets.to_f | |
weight_in_kilos = weight_in_pounds / 2.2 | |
puts weight_in_kilos.to_s + 'weight in kilos' |
OlderNewer