Chapter

Progress

1

General

Progress: 0 %

2

Methods

Progress: 0 %

3

Object Orientation

Progress: 0 %

4

Type System

Progress: 0 %

5

Frozen vs Mutable & Conditions

Progress: 0 %

6

Enumerables

Progress: 0 %

7

Blocks

Progress: 0 %

General

The section below is scrollable. Click on the Run Button on the right side to get the Output of your Code

If you finished all the Tasks you can click on the Finish Button.

1.1 - Ruby

Ruby is an open source project. It was started in 1996 by Yukihiro 'Matz' Matsumoto. He is still the 'benevolent dictator' who decides on the future of the language. In a colossal break with tradition he did not choose a name starting with p for his scripting language (think perl, python, php) but opted for r instead. Ruby is a thoroughly object oriented scripting language. Even basic data types are objects:

In this example the number 1 is used as an object, the method to_s is called on it. The result is an Object of class String.

Task: Write the number 5 as a string - Don't forget to print every output with -> puts 'output' <- to the console!

Task Completed?

1.2 - Basics

In Ruby, you can print output using puts, print, or p - for example 'puts 2' prints 2 to the console

Task: Print to the console the sum of 45 + 28

Task Completed?

1.3 - Code Conventions

When you choose names for your objects, classes and methods you should stick to the following conventions to avoid confusing other Ruby developers:

In the last two examples the punctuation marks are really part of the method names!

Task: Create a variable and assign it to the string 'I love snake_case' and print it to the console!

Task Completed?

Output