If I run this
a = "hello"
b = "world"
a
b
in ruby
irb(main):007> a = "hello"
=> "hello"
irb(main):008> b = "world"
=> "world"
irb(main):009> a
irb(main):010> b
=> "world"
in python1
>>> a = "hello"
>>> b = "world"
>>> a
'hello'
>>> b
'world'
Ruby skips the result of a
(and if there were more consecutive lines of code it would skip their output too). Ruby only displays the output of the last consecutive command (in this case, b
)
Question
Is there a way to force ruby to not do that, that is, if there's >1 consecutive commands, to show the results of all of them, not just the last?
1. Python is just an example, most other scripting languages too.
irb
or are you pasting them in?