Thursday, November 21, 2013

Day 46

Today was a good day because I finally got Rails version 4.0 installed on my computer! I am pretty sure my computer noticed the amount of time I was spending on Apple's website checking out their Macs. Luckily for my computer, the desperation attempt to get me to not buy a Mac will not work. Was a valiant effort though. "You miss a 100% of the shots you don't take" - Wayne Gretzky.

Here is the code for the basic Ruby assignment below. Let me remind you, by basic I mean the first one and supposedly easy. It may or may not have taken me a half an hour. I plead the fifth.

The top code is the "advanced" way, and the bottom is the way a noob like me would have written it as. I take full credit for both though.


Basically, this just takes an array of mathematical operations and gives them a number value from 0-3 and the .rand selects the random number. Whatever number is it, it will go with the corresponding operation in the array, and display that operation on the command line.

So, if the random number is 0, it will display "+" on the command line (we start with 0 around here). I am pretty sure that is the symbol for addition in California. Don't quote me on that.



- Kyle

1 comment: