Starting the Variables chapter, and switching notes to Notion
Today I started working through the “Variables” chapter. It was a pretty smooth read, thanks to my previous experience with Python. As I worked through the chapter, I recorded my own questions to turn into flashcards.
Most of the concepts introduced in this chapter were already familiar. One terminology difference I noticed is that Ruby refers to these as method definitions, whereas I knew them as function definitions in Python. I also learned about blocks.
One of the biggest concepts introduced in this chapter was variable scope. A variable’s scope determines where it can be accessed within a Ruby program. Ruby’s scope rules differ depending on whether a variable is used within a block or a method.
A block can access local variables initialized in an outer scope. However, a local variable initialized for the first time inside a block cannot be accessed outside that block. Methods have their own local scope, so local variables initialized outside a method are not accessible inside it, and variables initialized inside a method are not accessible outside it.
I was also introduced to the different types of variables Ruby supports.
After reviewing my note-taking process, I realized that although Apple Notes works well, it lacks an important feature I need: Markdown. It is possible to export notes as Markdown, but that isn’t what I want. I want to see and write the Markdown directly as I type.
I now use Notion for my question-and-answer notes. I like that I can access it from anywhere and that it now works offline.
My goal for tomorrow is to begin the end-of-chapter questions and then start an active recall session.