- Driver code
- Recursion
- Looping
- Enumerables
- Arrays
- Ping pong pairing
- Debugging
- Pseudocode
- Refactoring
- Blocks
Driver code- Driver code is an efficent way to test each part of your code as you write a method. Every time your write a new peice of code, create a test to see if that code is running how you thought it would. Your driver code should display true if your code is running properly and false if your code is not doing what you want it to do.
Enumerable- The enumerable module is a list of methods that can be used on collection classes for the ability to sort the collection based on a specification that you give.
Driver code def empty_hash {} end puts empty_hash == {}
array = ["dog", "cat", "rat"] p array.any? {|word| word.length >= 5}
using the enumerable any go through each element in the array and determine if the length is greater than or equal to 5
Hi Scott, I really like your enumerable method example. I haven't used the any? method in any of the challenges yet, but I think that it's a good one to keep in mind. It seems like it could be pretty useful. To improve your code, you could add spaces between the curly brackets and pipes in the block, following the Ruby style guide:
array = ["dog", "cat", "rat"]
p array.any? { |word | word.length >= 5 }
This helps make the code a bit more readable.