Created
June 28, 2021 23:15
-
-
Save keldin-coding/600e27ed898f8ff71f1f23ffc7493fa2 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
# My least favorite valid Ruby code | |
"abc" "xyz" | |
# => "abcxyz" | |
# Truly cursed reminder that whitepsace doesn't matter for method invocation | |
# and that ary[index] syntax is just a fancy way to do ary.[](index) | |
[1] [2] | |
# => nil | |
foo = "abc" | |
foo. chars | |
# => ["a", "b", "c"] | |
foo .chars | |
# => ["a", "b", "c"] | |
foo . chars | |
# => ["a", "b", "c"] | |
[1] .[](0) | |
# => nil | |
[1, 2, 3] [0, 2] | |
# => [1, 2] | |
[1, 2, 3] [0, 1, 2] | |
# => Argument Error | |
ary = [1, 2, 3] | |
ary [1] | |
# => 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment