Kristen Nestler#72
Conversation
corneliusellen
left a comment
There was a problem hiding this comment.
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!" | |||
| cups_of_flour = 2 | ||
| has_sauce = "yes" | ||
|
|
||
| if has_sauce = "yes" && cups_of_flour>=2 |
There was a problem hiding this comment.
= 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.
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 |
| # YOU DO: Write code that will reassign the last item in the animals | ||
| # array to "Gorilla" | ||
|
|
||
| animals[-1]= "Gorilla" |
| The number of cars on a lot. Many cars will have different attributes and many will have the same. Using a hash will allow us to use the objects a key instead of the integer. | ||
|
|
||
| 8. What questions do you still have about hashes? | ||
| How often are hashes used? |
There was a problem hiding this comment.
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!