Parentheses
#ruby
In Ruby, the use of parentheses for method calls is optional in cases where no arguments are passed to the method. The following statements are therefore equal: irb> fox.class() => String irb> fox.class => String It's common practice (and encouraged) to include parentheses for method calls with multiple arguments, such as the insert method of the String class:
irb> "jumps over the lazy dog".insert(0, 'The quick brown fox ')
=> "The quick brown fox jumps over the lazy dog"
This call inserts the second argument passed to the insert object ("The quick brown fox ") at position 0 of the receiving String object ("jumps over the lazy dog"). Position 0 refers to the very beginning of the string.
If you want to change selection, open original toplevel document below and click on "Move attachment"
Summary
status | not read | | reprioritisations | |
---|
last reprioritisation on | | | suggested re-reading day | |
---|
started reading on | | | finished reading on | |
---|
Details