Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

ruby struct

Customer = Struct.new(:name, :address) do
  def greeting
    "Hello #{name}!"
  end
end

dave = Customer.new("Dave", "123 Main")
dave.name     #=> "Dave"
dave.greeting #=> "Hello Dave!"
Source by www.bigbinary.com #
 
PREVIOUS NEXT
Tagged: #ruby #struct
ADD COMMENT
Topic
Name
9+7 =