Learning Outcomes - 12th March
What I focused on Learning the past Couple of Days
Require vs require_relative
Require and require_relative are used like an import in languages like python, java, etc.
The difference between the 2 is that with require, the path that provided will most likely be in the ./lib directory since ruby defaults the $LOAD_PATH variable to that directory.
With require_relative, the path provided is relative to the current directory.Array methods
I also discovered some cool array methods that can come in handy to simplify the problems like uniq and first. Uniq strips all the duplicates in an array and returns a new array while first returns only the first element of the list.Hashes
I looked into creation and accessing elements of hashes and nested hashes.To access a nested hash I found to ways of accessing it. One is the conventional way which is hash[x][y] where x is a nested Hash inside hash and y is a key in x.