O'Reilly logo

Seven Languages in Seven Weeks by Bruce A. Tate

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Day 2: Floating Down from the Sky

At the time, one of the most striking scenes in Mary Poppins was her entrance. She floated into town on her umbrella. My kids will never understand why that entrance was groundbreaking stuff. Today, you’re going to experience a little bit of the magic that makes Ruby click. You’ll learn to use the basic building blocks of objects, collections, and classes. You’ll also learn the basics of the code block. Open up your mind to a little magic.

Defining Functions

Unlike Java and C#, you don’t have to build a whole class to define a function. You can define a function right in the console:

 
>>​ def tell_the_truth
 
>>​ true
 
>>​ end

Every function returns something. If you do not specify an explicit return, the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required