Skip to content

Instantly share code, notes, and snippets.

@takaaki
Created November 4, 2008 11:09
Show Gist options
  • Save takaaki/22117 to your computer and use it in GitHub Desktop.
Save takaaki/22117 to your computer and use it in GitHub Desktop.
# Class methods
YAML.load()
YAML::load()
# Array and Hash
array = Array.new
array = []
hash = Hash.new
hash = {}
# variables
# a)
x = 0
y = 0
z = 0
# b)
x = 0; y = 0, z = 0
# c)
x = y = z = 0
# synonyms
# although I acknowledge "size" and "length" are not always synonyms,
# but in most cases, they are.
"hello".size
"hello".length
# how to return nil
# a)
def do_somehting
# Cool code here.
rescure
return nil
end
# b)
def do_somehting
# Cool code here.
rescure
nil
end
# c)
def do_somehting
# Cool code here.
rescure
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment