Tag Archive | programming

Learn to Code 1 (Swift Playgrounds) #1

I chose the “Checking for Switches” lesson because it helped me learn how to plan for the unexpected. This lesson taught me how to plan for different circumstances using an “if” statement. In this case, I saw that there are three switches, and every time there is a different amount of switches that need to be toggled. So I had to use an “if” statement in order to complete it. I realized that if a switch was closed, then it would need to be toggled, and if a switch was already on, then Byte would just walk forward and I would use the same “if” statements for the next switch.

At first, I was completely confused out of my mind. I was like, “is this even possible?” I tried reading the introduction over and over again, hoping a realization would hit me and I would know how to do it. But after going through the introduction three times, I still didn’t get it. And so I read the directions over and over again, and tried something I thought was correct. Unfortunately, it wasn’t correct. After a few trial and errors, the correct solution finally came to me. I realized what I had to do and did it, and completed the lesson!

I still have a few more lessons I have to complete, but without this lesson, I would have never learned how to plan for the unexpected. Overall, “Learn to Code 1” has been a great experience so far and I’m sure I will always need to use an “if” statement in the future.