Skip to content

Instantly share code, notes, and snippets.

class Cup
attr_accessor :color,
:contents,
:lid
def initialize(contents = :empty)
puts self.object_id
@color = "blue"
@contents = contents
@lid = false
class Cup
attr_accessor :color,
:contents,
:lid
def initialize(contents = :empty)
puts self.object_id
@color = "blue"
@contents = contents
@lid = false
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."
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}"
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}"
# 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,
# 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,
# 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
# 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
# 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