This file contains hidden or 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 Cup | |
attr_accessor :color, | |
:contents, | |
:lid | |
def initialize(contents = :empty) | |
puts self.object_id | |
@color = "blue" | |
@contents = contents | |
@lid = false |
This file contains hidden or 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 Cup | |
attr_accessor :color, | |
:contents, | |
:lid | |
def initialize(contents = :empty) | |
puts self.object_id | |
@color = "blue" | |
@contents = contents | |
@lid = false |
This file contains hidden or 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
print "How old are you? " | |
age = gets.chomp | |
print = "How tall are you? " | |
height = gets.chomp | |
print = "How much do you weight " | |
weight = gets.chomp | |
puts "So you'r #{age} old, and you are #{height} tall, and #{weight} heavy." |
This file contains hidden or 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
letters = "a".."g" | |
vowels = ["a", "e", "i", "o", "u"] | |
# Loop through each letter and print whether it is a vowel or consonant | |
# letters.each_with_index do |letter, index| | |
# if letter == "a" || letter == "e" || letter == "i" || letter == "o" || letter == "u" | |
# puts "vowel at index #{index}" | |
# else | |
# puts "consonant at index #{index}" |
This file contains hidden or 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
letters = "a" | |
vowels = ["a", "e", "i", "o", "u"] | |
# Loop through each letter and print whether it is a vowel or consonant | |
# letters.each_with_index do |letter, index| | |
# if letter == "a" || letter == "e" || letter == "i" || letter == "o" || letter == "u" | |
# puts "vowel at index #{index}" | |
# else | |
# puts "consonant at index #{index}" |
This file contains hidden or 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
# Convert all of the following country data in to a Hash, like that of Angola | |
# Angola | |
angola = { | |
"id" => "AGO", | |
"name" => "Angola", | |
"population" => 21_471_618, | |
"capital" => "Luanda", | |
"latitude" => -8.81155, | |
"longitude" => 13.242, |
This file contains hidden or 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
# Convert all of the following country data in to a Hash, like that of Angola | |
# Angola | |
angola = { | |
"id" => "AGO", | |
"name" => "Angola", | |
"population" => 21_471_618, | |
"capital" => "Luanda", | |
"latitude" => -8.81155, | |
"longitude" => 13.242, |
This file contains hidden or 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
# Alice: | |
# id: ALI | |
# name: Alice | |
# birth date: April 4, 1977 | |
# age: 37 | |
# job title: Data Analyst | |
# interests: Communications, Keeping Secrets | |
# trustworthy?: yes | |
# 1. convert the specification for `Alice` into code, like we did last class |
This file contains hidden or 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
# Alice: | |
# id: ALI | |
# name: Alice | |
# birth date: April 4, 1977 | |
# age: 37 | |
# job title: Data Analyst | |
# interests: Communications, Keeping Secrets | |
# trustworthy?: yes | |
# 1. convert the specification for `Alice` into code, like we did last class |
This file contains hidden or 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
# Alice: | |
# id: ALI | |
# name: Alice | |
# birth date: April 4, 1977 | |
# age: 37 | |
# job title: Data Analyst | |
# interests: Communications, Keeping Secrets | |
# trustworthy?: yes | |
# 1. convert the specification for `Alice` into code, like we did last class |
NewerOlder