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 check_for_fizz(n) | |
if (n % 15).zero? | |
"FizzBuzz" | |
elsif (n % 5).zero? | |
"Buzz" | |
elsif (n % 3).zero? | |
"Fizz" | |
else | |
n | |
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
def check_for_fizz(number) | |
if number % 5 == 0 and number % 3 == 0 # if the remainder of the number is both divisible by 5 and leaves 0 leftover and divisible by 3 and leaves 0 leftover using the modulo operator, it will print "FizzBuzz" | |
puts "FizzBuzz" | |
elsif number % 5 == 0 # if the remainder of the number is divisible by 5 leaves 0 leftover the program will return the word "Buzz" | |
puts "Buzz" | |
elsif number % 3 == 0 # if the remainder of the number is divisible by 5 leaves 0 leftover the program will return the word "Fizz" | |
puts "Fizz" | |
else | |
puts number # if the number does not fit into any of these equations it returns the integer you selected | |
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
def check_for_fizz(input) | |
if (input % 15 == 0) | |
"FizzBuzz" | |
elsif (input % 5 == 0) | |
"Buzz" | |
elsif (input % 3 == 0) | |
"Fizz" | |
else | |
input | |
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
puts "So, let's see if we can get this baby running, shall we?!" | |
puts | |
puts "What number do you want to play to? (1-_): " | |
def check_for_fizz_buzz(number) | |
if number % 3 == 0 && number 5 == 0 # this line tells the program to check if the index (x) is divisible by 3 and 5. | |
puts "fizzbuzz" # if the index meets this criteria, the program should put "fizzbuzz" in its place | |
elsif number % 5 == 0 # checks if it is not divisible by 3 but it is by 5 | |
puts "buzz" # if it meets this criteria, then to replace it with "buzz" | |
elsif number % 3 == 0 # or if it is not divisible by 5 but it is by 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
#Fizzbuzz | |
seq = (1..100) | |
#instinctually set a variable = to the range 1.100 inclusive although I saw online that you can directly run a .each on (1..100) w/o defining a variable. | |
def check_for_fizz_buzz(number) | |
if (i % 15).zero? | |
"FizzBuzz" | |
elsif (i % 3).zero? | |
"Fizz" |
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 "Welcome to Restaurant 720" | |
puts | |
courses = {"appetizers" => ["nachos", "bloomin onion", "guacamole", "breadsticks", "garlic knots", "none"], | |
"entrees" => ["hamburger", "chicken strips", "fried chicken", "none"], | |
"desserts" => ["chocolate cake", "apple pie", "none"], | |
"drinks" => ["soda", "wine", "coffee", "tea", "none"]} | |
order = [] | |
# this is an awesome setup above! |
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
apps =[ "nachos","guacamole","bloomin onion","bread sticks","garlic knots", "No thanks"] | |
ents =["hamburger","lobster","chicken","No thanks"] | |
desserts= ["coffee","cake","ice cream","No thanks"] | |
drinks= ["Coke", "Water", "Beer", "Milkshake","No thanks"] | |
bill=[] | |
# It seems like you list the items several times in your code: | |
drinks.each_with_index do |item,index| | |
puts "#{index}: #{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 | |
puts "Hi! Welcome to Keeley's Kwirky Kuisine! Please see our menu below:" | |
drinks = ["pina colada", "pbr", "fireball shot", "smirnoff ice", "champagne"] | |
apps = [ "nachos", "guacamole", "a bloomin onion", "bread sticks", "garlic knots" ] | |
entrees = [ "a hamburger", "chicken strips", "fried chicken"] | |
desserts = [ "chocolate cake", "apple pie", "banana split", "creme brulee"] | |
user_order = {} | |
# The first area of your app lists all the items available: |
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 "Welcome to Restaurant 720" | |
#appetizers------------------------------- | |
apps = ["none", "nachos", "bread sticks", "garlic knots"] | |
ents = ["none", "burger", "steak", "chicken"] | |
dess = ["none", "pie", "cake", "ice cream"] | |
drin = ["none", "water", "soda", "juice"] | |
#create an empty hash here |
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 "Welcome to Restaurant720" | |
puts | |
users_order = [] | |
# recommended style ot declare your data (the coure arrays) ahead of time, and then act on it throughout the rest of the program | |
drinks = ["cola", "water", "tea"] | |
puts "Drinks:" |