The Random Ramblings

lost? dazed? confused? dont come here then as this aint goona help!!

Day 2 of Earlsfield code week

First learning experience and it took place in minutes of starting.

p foo

is the same as

puts foo.inspect

so if you want to just print out a load of string information from any object you send it as the Ruby standard message to_s

Short cut to be able to read an attribute

attr_reader    :foo

if you want to be able to read and write to an attribute you simply create it as

attr_accessor     :foo

Blocks are just chunks of code, either between braces or keywords do and end. Current style is that if it fits onto a single line braces are used, any thing more than one line do and end are used.

Finally the enumerator section has completely blow my mind but not as much as the examples given for how blocks can be objects :(

So that was a pretty intense day and three more chapters completed. Looks like a slightly easier start tomorrow as it picks up standard types..

Find Me
Javascript learning