Created
February 12, 2015 03:00
-
-
Save ajnadel/8ee5562827c482eff6c9 to your computer and use it in GitHub Desktop.
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
hello, goodbye, re = ARGV | |
print hello | |
puts " and #{goodbye}" |
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 "hello!" | |
puts "what is up?" |
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 "here we go" | |
# comment lineeee | |
puts "phew. made it." |
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 "2 * 2 = #{2*2}" | |
puts "3 + 7 / 17^8 = #{3+7/17**8}" #resolves to 3, but is actually 3.0000000000000001 |
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 "Mary had a little lamb." | |
puts "Its fleece was white as #{'snow'}." | |
puts "And everywhere that Mary went." | |
puts "." * 10 # what'd that do? | |
end1 = "C" | |
end2 = "h" | |
end3 = "e" | |
end4 = "e" | |
end5 = "s" | |
end6 = "e" | |
end7 = "B" | |
end8 = "u" | |
end9 = "r" | |
end10 = "g" | |
end11 = "e" | |
end12 = "r" | |
# watch that print vs. puts on this line what's it do? | |
print end1 + end2 + end3 + end4 + end5 + end6 | |
puts (end7 + end8 + end9 + end10 + end11 + end12) *2 |
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 """Mon | |
Tues | |
Wed | |
Thurs | |
Fri | |
Sat | |
Sundy""" |
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
word = gets.chomp | |
puts word[1..-1] + word[0] + 'ay' |
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 open(ARGV.first).read |
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
print 'Cash: $' | |
puts gets.chomp.to_f / 10 |
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
user_name = ARGV.first | |
prompt = '> ' | |
puts "Hi #{user_name}." | |
puts "I'd like to ask you a few questions." | |
print "Do you like me #{user_name}?\n", prompt | |
likes = $stdin.gets.chomp | |
print "Where do you live #{user_name}?\n", prompt | |
lives = $stdin.gets.chomp | |
print "What kind of computer do you have?\n", prompt | |
computer = $stdin.gets.chomp | |
puts """ | |
Alright, so you said #{likes} about liking me. | |
You live in #{lives}. Not sure where that is. | |
And you have a #{computer} computer. Nice. | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment