Reputation: 13487
In Python's IDLE if you press shift+Enter you can begin typing on a newline, what is the Ruby equivalent?
I am trying to pass arguments to a function using a hash argument and would like to be able to span each hash item on its own line. How can I do this in interactive Ruby?
Upvotes: 0
Views: 570
Reputation: 114138
From the documentation:
An input is executed when it is syntactically complete.
Entering incomplete expressions results in "multi-line mode", e.g. starting a hash with {enter
$ irb
irb(main):001:0> {
irb(main):002:1* foo: 1,
irb(main):003:1* bar: 2
irb(main):004:1> }
#=> {:foo=>1, :bar=>2}
irb(main):005:0>
Upvotes: 2
Reputation: 13487
Just figured it out! I need to separate each argument with a comma.
Upvotes: 0