Conditional statements are a fantastic way to tell Ruby to perform a task based on a specific set of guidlines. For example, here is some code from my (in progress) Tic Tac Tow with AI project:
As I’m making my way through the Object Oriented unit of Ruby, I’m gaining a deeper understanding of how to debug with ‘pry’. For those who don’t know, ‘pry’ is a powerful way to go inside (or “pry into”) a particular method in a program to test its functionality as well as your coding syntax. It also won’t go inside the method if the method itself is broken, therefore revealing bugs within the code before breaking into it.
After finishing the Intro to Ruby units and moving pretty quickly through HTML and CSS, I am finding Procedural Ruby to be quite the challenge. So challenging, that in some of the labs a HINT will suggest doing a Google search. In a moment of pure desperation, I followed that hint and it took me to an exact solution for the lab. I immediately started to panic because I’ve been taught my entire life that if you don’t come up with an answer on your own, you are cheating. Not only did you not “earn the grade,” but you didn’t learn the subject matter. Then, a thought occured that this is a computer programming ONLINE course and the lab had a section telling us to search out the information, so I calmed down and looked at the solution.
Why am I doing this to myself? After spedning a grueling 5 years to earn a Bachelor’s degree in music composition, why am I putting myself through another rigorous journey to learn programming? I found the answer to be about fulfillment in life. The truth is, I’m not fulfilled by working long, exhausting hours in the service industry. Then, to maintain a strict schedule to create music on my days off when I’d rather be recovering from my day job only serves to drain both energy and creativity. It’s an infinite loop of physical recovery.