Upcoming Trip to South America
How I am going to keep track of everything
I am counting down the days until I board my flight to the captial of Peru!! I wrote a small program that will display my statement of purpose, my itinerary, and how many more days I have left until my return flight. Since Archer is one of my favorite TV shows, I often run my programs under the name of Woodhouse and he is incredibly helpful. In this blog post I’ve linked my incredibly simple program to github so you guys can take a look! The beginning was easy. I tried to use a little bit of everything I’ve learned in the first ten chapters of Learn to Code by Chris Pine.
I used my first array:
1 2 3
I have to admit, I’m still a little confused on what exactly an array is. Chris Pine usually does an excellent job explaining things so I’m not sure if I’m just unusually thick or if array’s are actually a hard concept for a newbie to understand right away.
After doing a little research, it seems to me that an array is listing of objects which all share a common element. The computer is able to see them as individual units but also as a singular group unit which is valuable when you’re dealing with a large amount of objects. EXAMPLE two different groups of objects and the comp has to deal with them in seperate ways.
Here comes Woodhouse!!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
I love the
def function, which is just short for ‘define’. IF there is one thing I’m certain about, is that programmers will find the laziest way to type/do everything. As James explained it to me, the define function is like creating a written contract with your computer. You tell it that under these circumstances I want you to do the following… And you explain in detail exactly how you want it to behave. I love it! It allows for so much creativity. So the
def alerts the computer/program that you’re are about to give it its contract. The
ask is the actual command that you define and will use in the future, while
question is the variable that you’ll define after the contract is written. In the code I wrote above, the
'Miss, which would you like to know about?' is how I decided to define the varibale
Another thing that I would like to point out to other newbie coders of Ruby is that
elsif is a subset of the
if function, and that
else is the counterpart to the
if. You can fit as many
elsifs as you want under
if but you can’t keep piling on the
elses after the
if and one
else within a loop. I learned that after much frustration.
The second part of the code is the following:
1 2 3 4 5 6 7 8 9 10 11 12 13
This was actually the hardest part of the code. I spent more time on this part than I should have because I kept crashing my computer. I made the mistake of putting in
if reply == 'yes' ...etc
Which made my computer have a panic attack as it tried to compute the huge motherload of tasks I had just given it. To repeat the loop infinatum. Impossible, so my computer took the easy way out and committed suicide every time. Poor thing. I just removed the
while true and it fixed everything.