-
Notifications
You must be signed in to change notification settings - Fork 648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kon Ham #428
base: master
Are you sure you want to change the base?
Kon Ham #428
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kon, Great work on this! I left some high level notes on where you could think about refactoring your code.
frogs -= 1 | ||
puts "then there were #{frogs} speckled frogs." | ||
end | ||
if frogs === 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question for you to research: What's the difference in Ruby between =
, ==
, and ===
?
if high % 15 === 0 | ||
print "FizzBuzz" | ||
elsif high % 5 === 0 | ||
print "Buzz" | ||
elsif high % 3 === 0 | ||
print "Fizz" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like these lines are repeated from inside your while
loop. This is a good candidate to refactor so you don't have repeating conditionals with the same output.
Let's make a function that will take two parameters: the string that the user wants to encrypt, and the number of degrees we will shift our alphabet to the left. | ||
|
||
`def caesar_cipher(string, degrees)` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work making a clear step-by-step document with some code snippets to illustrate the explanation of how you'll go about making a caesar cipher.
def add_topping(topping) | ||
toppings.push(topping) | ||
end | ||
|
||
def remove_topping(topping) | ||
toppings.delete(topping) | ||
end | ||
|
||
def change_protein(protein) | ||
self.protein = protein | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another way of updating the attributes directly is to use the instance variable @protein
(or @toppings
).
Here is my prework!