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
# send following line to irb and see the result | |
a = 1, b = 2*5 | |
# perhaps this is better | |
a = 1, (b = 2*5) |
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
i = "1i" | |
i.to_i # => 1 | |
Integer(i) # => ArgumentError: invalid value for Integer(): "1i" | |
f = "1.2f" | |
f.to_f # => 1.2 | |
Float(f) # => ArgumentError: invalid value for Float(): "1.2f" |
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 A | |
def self.constant | |
[1, 2, 3] | |
end | |
B = constant and nil | |
end |
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 A | |
def b | |
data = [1, 2, 3] | |
def data.foo! | |
self.sample | |
end | |
data | |
end | |
end |
NewerOlder