-
Notifications
You must be signed in to change notification settings - Fork 65
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
Kristen Nestler #72
base: main
Are you sure you want to change the base?
Kristen Nestler #72
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.
Nice work on this @knestler . I can tell you have a solid understanding of Ruby syntax, datatypes, and conventions. Please see my comments and I would encourage you to adjust anything that should be fixed.
@@ -0,0 +1,10 @@ | |||
|
|||
'''puts "Hello World!" |
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.
This is not valid syntax!
cups_of_flour = 2 | ||
has_sauce = "yes" | ||
|
||
if has_sauce = "yes" && cups_of_flour>=2 |
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.
=
is the assignment operator. You should be using a different operator here ==
.
To prove this, try changing your has_sauce
variable to "no", and then running line 70 again - it still returns true! Can you figure out why this is? Comment here!
5. What is the Ruby syntax for an if statement? | ||
|
||
if variableX = 2 |
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.
Again, do not use the assignment operator for if statements
7. Provide an example of the Ruby syntax for an if/elsif/else statement: | ||
|
||
if variableX = 2 |
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.
Here too.
|
||
# YOU DO: Write code that will reassign the last item in the animals | ||
# array to "Gorilla" | ||
|
||
animals[-1]= "Gorilla" |
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! 👏
|
||
8. What questions do you still have about hashes? | ||
How often are hashes used? |
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.
All the time!!! They are a very useful datatype because they allow a "lookup" that is FAST!
(aka, it's much faster to find something in a hash with 1 million key/value pairs than to find the same thing in an array with 1 million elements)
This is my mod 0 work!