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
characters = { | |
"Tyrion Lannister" => "House Lannister", | |
"Jon Snow" => "Night's Watch", | |
"Hodor" => "House Stark", | |
"Stannis Baratheon" => "House Baratheon", | |
"Theon Greyjoy" => "House Greyjoy" | |
} | |
characters.each do |character, org| | |
puts "#{character} represents #{org}." |
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
favorite_movies = [ | |
{ title: 'The Big Lebowski', year_released: 1998, director: 'Joel Coen', imdb_rating: 8.2 }, | |
{ title: 'The Shining', year_released: 1980, director: 'Stanley Kubrick', imdb_rating: 8.5 }, | |
{ title: 'Troll 2', year_released: 1990, directory: 'Claudio Fragasso', imdb_rating: 2.5 } | |
] | |
favorite_movies.each_with_index do |movie , index| | |
title = movie[:title] | |
year = movie[:year_released] | |
puts "#{year}: #{title}" |
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
puts "How much $ is due?" | |
cost = gets.chomp.to_f | |
puts "How much has been tendered?" | |
tendered = gets.chomp.to_f | |
if tendered < cost | |
puts "The customer needs to pay you more dough, bro." | |
else | |
change = tendered - cost |
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
require 'pry' | |
require 'csv' | |
# class Product | |
# @@all = [] | |
# def initialize (item, price) | |
# @item = item | |
# @price = price | |
# end |
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
require 'pry' | |
require 'csv' | |
def prompt(query) | |
puts query | |
gets.chomp | |
end | |
def get_data | |
item = prompt "What is the name of the item?" |
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
puts "What would you like to say?" | |
phrase = gets.chomp | |
def playback(phrase) | |
puts "You said: #{phrase}" | |
end | |
playback(phrase) |
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
puts "What would you like to say?" | |
phrase = gets.chomp | |
def playback(phrase) | |
if phrase == "Nothing!" | |
puts "OK, fine!" | |
elsif phrase == "I have a lot to say." | |
puts "Ain't nobody got time for that!" | |
else | |
puts "You said: #{phrase}" |
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
puts "What would you like to say?" | |
phrase = gets.chomp | |
def lots_to_say | |
phrases = [] | |
puts "Ok, let's hear it!" | |
input = "" | |
while input != "done" | |
input = gets.chomp | |
if input == "done" |
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
puts "What would you like to say?" | |
phrase = gets.chomp | |
def lots_to_say | |
phrases = [] | |
puts "Ok, let's hear it!" | |
input = "" | |
while input != "done" | |
input = gets.chomp | |
if input == "done" |
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
puts "What would you like to say?" | |
phrase = gets.chomp | |
def lots_to_say | |
phrases = [] | |
puts "Ok, let's hear it!" | |
input = "" | |
while input != "done" | |
input = gets.chomp | |
if input == "done" |