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
| def first_question | |
| puts "Would you like to start a new session?" | |
| answer = gets.chomp.downcase | |
| if answer == "yes" | |
| new_session | |
| else | |
| puts "Ok. Would you like to review a previous session?" | |
| prev_session = gets.chomp.downcase |
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
| def error_message | |
| puts "Error invalid amount of money exiting program" | |
| end | |
| def number_check(number) | |
| # Try to make sure everything is indented consistently | |
| number =~ /^\d+(\.\d{0,2})?$/ | |
| end | |
| def letter_check(word) |
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' | |
| def good_input?(input) | |
| if !(input =~ /^(\d*)\.\d{2}$/) | |
| return false | |
| end | |
| true | |
| 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
| #LIGHT = 5 | |
| #MEDIUM = 7.5 | |
| #BOLD = 9.75 | |
| sub_total = 0 | |
| sales_list = [] | |
| def is_valid_money?(amount) | |
| !!amount.to_s.match(/\A\d+(\.\d{2})?\z/) | |
| 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
| team_data = [ | |
| { | |
| home_team: "Patriots", | |
| away_team: "Broncos", | |
| home_score: 7, | |
| away_score: 3 | |
| }, | |
| { | |
| home_team: "Broncos", | |
| away_team: "Colts", |
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' | |
| games = [ | |
| { | |
| home_team: "Patriots", | |
| away_team: "Broncos", | |
| home_score: 7, | |
| away_score: 3 | |
| }, | |
| { |
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' | |
| games = [ | |
| { | |
| home_team: "Patriots", | |
| away_team: "Broncos", | |
| home_score: 7, | |
| away_score: 3 | |
| }, | |
| { |
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
| =begin | |
| salutations = [ | |
| 'Mr.', | |
| 'Mrs.', | |
| 'Mr.', | |
| 'Dr.', | |
| 'Ms.' | |
| ] | |
| =end | |
| salutations = [ |
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
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
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' | |
| def sort_from_biggest_to_smallest(sorted_statistics, unsorted_statistics) | |
| unsorted = unsorted_statistics | |
| popped_number = unsorted_statistics.pop | |
| sorted = sorted_statistics | |
| remaining_unsorted_objects = [] | |
| if unsorted.empty? | |
| return sorted |
OlderNewer