DistroPropaganda/proveRuby/metodi.rb

24 lines
426 B
Ruby
Raw Permalink Normal View History

2018-11-24 13:20:20 +01:00
def say_goodnight(name)
result = 'Good night ' + name
return result
end
def say_goodnight2(name)
result = 'Good night ' + name.capitalize + ' ' + "#{name.capitalize}"
return result
end
puts say_goodnight('jops')
puts say_goodnight2('jops')
animals = %w{ cane gatto coniglio }
animals.each {|animal| puts animal }
3.times {print 'ho'}
def wrap &b
print "Santa says: "
3.times(&b)
print "\n"
end
wrap { print "Ho! "}