-
Le Lambeau, Philippe Lançon
-
Leurs enfants après eux, Nicolas Mathieu
-
An Absolutely Remarkable Thing, Hank Green
-
What Happened, Hillary Rodham Clinton
-
Inspired: How to Create Tech Products Customers Love, Marty Cagan
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
>> pastries = ['croissant', 'cake', 'pie'] | |
>> pastries.each {|p| puts "GIVE ME ONE " + p.upcase + "!"} | |
=> GIVE ME ONE CROISSANT! | |
GIVE ME ONE CAKE! | |
GIVE ME ONE PIE! | |
# let's change the contents of || to something nonsensical | |
>> pastries.each {|armchair| puts "GIVE ME ONE " + armchair.upcase + "!"} | |
=> GIVE ME ONE CROISSANT! |
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
class BakedGood | |
attr_reader :name | |
def initialize(name) | |
@name = name | |
end | |
end | |
>> french_pastry = BakedGood.new('croissant') | |
=> #<BakedGood:0x007f7f6c4616d8 @name="croissant"> |
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
# defining a hash | |
bakery = { | |
name: 'Véronique Mauclerc', | |
address: '83 rue Crimée', | |
nearest_metro_station: 'Laumière', | |
} | |
# indexing into the hash | |
>> bakery[:name] | |
=> "Véronique Mauclerc" |
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
# OPTION 1 | |
# defining the method | |
def bake(pastry) | |
p 'Currently baking ' + pastry | |
end | |
# calling the method | |
>> bake('muffin') | |
=> "Currently baking muffin" |
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
contents_of_pastry_case = ['croissant', 'apple pie', 'blueberry muffin'] | |
>> contents_of_pastry_case[0] | |
=> "croissant" | |
>> contents_of_pastry_case[1] | |
=> "apple pie" |