Created
November 4, 2008 11:09
-
-
Save takaaki/22117 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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