more crap

This commit is contained in:
Dan Buch 2009-06-11 21:56:55 -04:00
parent 5e7e6553ab
commit e53ad11e51
3 changed files with 48 additions and 0 deletions

15
metherds.rb Normal file
View File

@ -0,0 +1,15 @@
def main()
5.times { puts "Mice!\n" }
ele = "Elephants like Peanuts, but they is poison!!"
puts ele + ' is of length = ' + ele.length.to_s
puts "I yam: " + self.to_s
end
if __FILE__ == $0
main()
end

27
mydefs.rb Normal file
View File

@ -0,0 +1,27 @@
def hello()
puts 'Hello!'
end
def hello_to(name)
puts 'Hello thar ' + name.to_s
end
def hello_again_to name
puts 'Why hello again ' + name.to_s
end
def main()
puts 'your name be? '
name = gets().chomp()
hello()
hello_to(name)
hello_again_to(name)
end
if __FILE__ == $0
main()
end

6
rice.rb Normal file
View File

@ -0,0 +1,6 @@
rice_on_square = 1
64.times do |square|
puts "On square #{square + 1} are #{rice_on_square} grain(s)"
rice_on_square *= 2
end