software-development-lessons

Ruby Foundations

This lesson discusses the basics of the ruby language

Slides

Topics

Objects & Methods

"hello"

8.3

[4, 8, 15]
"hello".class
=> String

8.3.class
=> Float

[4, 8, 15].class
=> Array
# String#capitalize
"ian".capitalize
=> "Ian"

# String#length
"ian".length
=> 3

# Float#round
8.3.round
=> 8

# Float#ceil
8.3.ceil
=> 9

# Array#sort
[3, 2, 1].sort
=> [1, 2, 3]

# Array#length
[4, 8, 15].length
=> 3
# returns another Array
[4, 8, 15].reverse
=> [15, 8, 4]

# returns an Integer
[4, 8, 15].length
=> 3
[4, 8, 15].length.odd?
=> true

First Letters

What Kind of Thing?

Building Blocks

That’s all we need for now. We can build anything with these.

We Are Inventors

Resources