Ruby Bus

Terry Cai

China, GZ
07/05/2015

Ruby

  • A PROGRAMMER’S BEST FRIEND

Ruby Logo

Hello world

    # Ruby knows what you
    # mean, even if you
    # want to do math on
    # an entire Array
    cities  = %w[ London
                  Oslo
                  Paris
                  Amsterdam
                  Berlin ]
    visited = %w[Berlin Oslo]

    puts "I still need " +
         "to visit the " +
         "following cities:",
         cities - visited

Read document

https://devdocs.io/ruby/

Methods implement

def one_plus_one
  1 + 1
end

Calling Methods

one_plus_one()

parenthesis are optional

one_plus_one

Receiver

self - self is the default receiver.

    my_object.my_method

    #or

    self.my_method

Thanks!

Questions?

つづく

Ruby Bus Presentation

Welcome ruby get start course, ruby is very nice language as offcial website said, A PROGRAMMER'S BEST FRIEND. Well, let check it out.

Jul 05, 2015   Terry Cai    Comments

Comments