Chaining Statements Together
#ruby
Using characters to separate commands in Ruby is unnecessary, unless we want to chain multiple statements together on a single line. In this case, a semicolon (;) is used as the separator. However, if you put every statement on its own line (as we've been doing until now), the semicolon is completely optional. If you chain multiple statements together in the interactive shell, only the output of the last command that was executed will be displayed to the screen:
irb> fox.class; fox.length; fox.upcase
=> "THE QUICK BROWN FOX"
Don't be confused. All the messages were sent and methods executed, but irb only shows us the last one.
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