Created
September 21, 2016 10:48
-
-
Save jacksonpires/1f825203ed3a5990ff1dcb9eb1720ed4 to your computer and use it in GitHub Desktop.
Usando Struct com Ruby
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
Customer = Struct.new(:name, :address, :zip) | |
customers = [] | |
customers.push(Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)) | |
customers.push(Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)) | |
customers.push(Customer.new("Jane Doe", "456 Elm, Anytown NC", 12345)) | |
customers.each do |customer| | |
puts customer.name | |
puts customer.address | |
puts customer.zip | |
puts "---------------------" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment