Ruby is Magic!

..another loop we will talk about today is the for loop. It looks something like this:

for variable in 1..5

  puts variable

end

Question: But you define the variable before, right?

Answer: Not in this case.

Question: Why?

Answer: It’s magic! It’s Ruby!

I’ve heard heard about Ruby’s magic and now I see it.

It was a tough day, but thanks to excellent guidance by Miriam, everything that could be explained, was explained and worked out in the end.

I do have to admit that today was the first day I came face-to-face with my fear of not being smart enough, as explained in my intro-blog. I did realise that not being smart enough is not the right way of putting it. It’s more like – thinking in the correct order.

Example: I was busy building sort of an oversimplified web-shop program in Ruby. I made these elaborate if statements and long, difficult code blocks. All this effort brought me half way and I realised that I could at least simplify my code by creating methods that do some repetitive tasks for me. So my first method ended up becoming another long and complicated set of code blocks.

Finally, Miriam showed us her solution. It was so clear and straight forward!!

This made me realise that I’ve been looking at my task too difficult and without a clear mapping of actions. Which in turn led to thinking: what if I never start thinking correctly?

However, thanks to the guidance and support from Codaisseur and my classmates, I also learned that through continued practice and exposure the correct thinking will come – which settled down my initial fear.

Curious to see what new knowledge and thoughts tomorrow brings!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s