Introduction to Ruby (Rails Girls)

Introduction to Ruby (Rails Girls)

A short introduction to Ruby, created with one of the Rails Girls events in mind.

It tries to cover variables, simple calculations, conditions, functions, collections, symbols and classes.

3ea55d185aee5756c52056419238eec8?s=128

Lukasz Wrobel

May 25, 2014
Tweet

Transcript

  1. 2.

    About me • Architect, team leader; • high-traffic websites: ◦

    nk.pl; ◦ Gadu-Gadu. • “Memoirs of a Software Team Leader”; • @lukaszwrobel
  2. 14.

    age = 22 if age > 30 puts "Too old"

    else puts "Acceptable" end
  3. 28.
  4. 30.
  5. 32.
  6. 33.

    friend = { "name" => "William", "age" => 45, }

    puts friend["name"] # => "William"
  7. 35.

    friend = { :name => "William", :age => 45, }

    puts friend[:name] # => "William"
  8. 36.
  9. 37.

    class Person def say_hello(name) puts "My name is " +

    name end end somebody = Person.new somebody.say_hello("Emily")
  10. 40.

    class Person def initialize(name) @name = name end def say_hello

    puts "My name is " + @name end end me = Person.new("Łukasz") me.say_hello # => "My name is Łukasz"