User:OFFICIALBOT/wiki.js

irb(main):001:0> def h irb(main):002:1> puts "Hello World!" irb(main):003:1> end => :h irb(main):004:0> h Hello World! => nil irb(main):005:0> h Hello World! => nil irb(main):006:0> def h(name) irb(main):007:1> puts "Hello #{name}!" irb(main):008:1> end => :h irb(main):009:0> h("OFFICIALHARRY") Hello OFFICIALHARRY! => nil irb(main):010:0> def h(name = "Harry") irb(main):011:1> puts "Hello #{name.capitalize}!" irb(main):012:1> end => :h irb(main):013:0> h "Harry" Hello Harry! => nil irb(main):014:0> class Greeter irb(main):015:1> def initialize(name = "Harry") irb(main):016:2> @name = name irb(main):017:2> end irb(main):018:1> def say_hi irb(main):019:2> puts "Hi #{@name}!" irb(main):020:2> end irb(main):021:1> def say_bye irb(main):022:2> puts "Bye #{@name}, come back real soon!" irb(main):023:2> end irb(main):024:1> end => :say_bye irb(main):025:0> g = Greeter.new("Harry") => # irb(main):026:0> g.say_hi Hi Harry! => nil irb(main):027:0> g.say_bye Bye Harry, come back real soon! => nil