ruby

References

Summary

Interpreted High-level Object-Oriented Just-in-time compilation Garbage collection

The idea was to create an object-oriented scripting language

You use periods to take properties

Symbols

Begin with a colon

Arrays

Use << to add to the end of an array

Hashes

Defined using curly brackets

key and value

Blocks

Use curly braces and pipes

.select

Classes

Class names must start with a capital letter

class Classname end

To create an element of the class

example = Classname.new

Initialize Function

Inside your class you can set up a function

def initialize(data1var, data2var, …) @data1 = data1var @data2 = data2var

Variables

Accessors

These are attaching a suffix with a dot

word.length

Object Variables

Use @

Methods

Examples:

Dots

.each iterates

Strings

#{} is used to insert variables in strings

"Hi I'm #{name}"

Conditionals

No colons used

if else end