Okay, had a break through of the meaning of the "!" while testing in the project for Lesson 4.
Original description of the "!" was with other methods like .reverse or .capitalize. It was said that these methods only made a copy of the value and that by adding "!" it would replace it. At first I thought it was just writing extra lines of code that couldn't be seen. What it actually does is replace the variable out permanently whereas without it the output would only be changed in that one instance.
Examples (Orange = input ; White = output):
1. This only changes the output once.
2. Same as above. The original reverse is not in the output because there was no print / puts command.
3. This changes the variable forever! Now "x" is always reversed.
This is what "!" does for methods like .capitalize and .reverse. There might be more to this function in the future.
Sunday, May 26, 2013
Wednesday, May 22, 2013
Ruby Lesson 3 and Setbacks
This is my second time going through Lesson 3. The first time I got to the Project portion and realized I needed to take notes, hence this blog. Now the second time over it's still confusing me, hopefully writing it all out will clarify some confusion.
Lesson 3 itself isn't bad at all, it's the Project that tosses them all together that's the problem. Maybe it's me, maybe it's the way Codeacademy explains the steps, or maybe assimilating all the knowledge and applying it is more of a challenge than I thought. Either way, I'm not givin' up.
Ruby Lesson 2 Section 4 of 4 and Project: Review and Thith Meanth War!
I am going to take this time to reflect that these lessons are the foundations of Ruby. As such it is important to know 100% of what is being taught, not 99%. This is because any small holes in our knowledge now can easily destroy a program later on. Remember, it only takes one bad line of code to crash a program.
Monday, May 20, 2013
Ruby Lesson 2 Section 2 / 3 of 4: Making Comparisons and Boolean Operators
Double sections! I know you're excited =)
Section 2 Topics
- Equal / Not Equal
- Less Than / Greater Than
Sunday, May 19, 2013
Ruby Lesson 2 Section 1: Introduction to Control Flow
Section Topics
- Control Flow
- expression / if
- else
- elsif
- unless
Control Flow gives us flexibility in the repsonse Ruby will return. Think about it like a do it yourself fantasy book where you given a story and choices. The story will change depending on the choices you make. This is the same with control flow, Ruby will return a designated response (choosing which block of code to run) depending on the user input.
Saturday, May 18, 2013
Ruby Lesson 1 Project: Putting the Form in Formmatter
With the
exception of Lesson 8, which is dubbed a challenge instead of of a
course like the others, each lesson has a project to complete. These
projects seem to incorporate much of what is learned throughout the
lesson and add some new material as well. The posts on these projects
will simply be about the new material presented.
Materials Presented
Materials Presented
- Prompting the User
- gets
- .chomp
- .capitalize
- "!"
- "#{}" String Interpolation
When looking
for user input we would usually ask a questions like "How old
are you?" or "What's your favorite color?" To display
these questions we would input commands like the "puts" and
"print".
Tuesday, May 14, 2013
Ruby Lesson 1 Section 4 of 4 Review
Even though this is a review I learned something about methods. Originally I stated that we can have multiple methods on one line. While this is true Ruby will can have them on separate lines and it will have the same output.
Ruby Lesson 1 Section 3: Writing Good Code
Section Topics:
- Single-Line Comments
- Multi-Line Comments
- Naming Conventions
Comments
To start off, why do we need comments in coding? These are some of the reasons I can think of:
Ruby Lesson 1 Section 2 of 4: String Methods
Section Topics:
- .length
- .reverse
- .upcase and .downcase
So methods are like commands except for the following (that I know of):
- A period is used before a method
- You can have more than one method on a line and Ruby will follow the sequence from left to right
Monday, May 13, 2013
Ruby Lesson 1 Section 1 of 4: Variables and Data Types
Section Topics:
- Data Types: Numbers, Booleans, Strings
- Variables
- Math
- puts and print
There are 3 Data Types: Numbers, Booleans, and Strings
Sunday, May 12, 2013
Birthdays and Accomplishments
Birthdays and New Years, birthdays and New Years. Barring major events, are two consistent times when people ask themselves "What have I done with my life?" It's a question that does not often have a pleasant response and can cause a person to re-evaluate their life.
Saturday, May 11, 2013
Why This Blog Exists
I started on my journey of learning Ruby coding a few months back on an on again off again basis. I started to get serious about learning again in the past few weeks utilizing tools like codeacademy.com. I was completing about a course a day when hit the course "Project: Redacted!" I realized that I didn't remember anything. I had to keep looking back at past courses/exercises to get the formatting and commands right, this wasn't working out.
I remember reading a post on advanced note taking and how someone finished a computer science course at MIT in a year (I will post link later when I find it). So this is reason for the blog. To document what I've learned as a way to help me remember.
Update: Here's the link http://calnewport.com/blog/2012/10/26/mastering-linear-algebra-in-10-days-astounding-experiments-in-ultra-learning/
Accomplishment: Started blog.
I remember reading a post on advanced note taking and how someone finished a computer science course at MIT in a year (I will post link later when I find it). So this is reason for the blog. To document what I've learned as a way to help me remember.
Update: Here's the link http://calnewport.com/blog/2012/10/26/mastering-linear-algebra-in-10-days-astounding-experiments-in-ultra-learning/
Accomplishment: Started blog.
Subscribe to:
Posts (Atom)