Issue #12929 has been updated by Martin Drst.


In Ruby, all operators have to be written at the end of the line to make it possible to distinguish between complete statements (with a missing semicolon) and continuations.

The only exception is the '.' operator, which is allowed to be on the next line to make method chaining look better, as follows:

```
array.map ...
     .select ...
     .reject ...
     .group ...
     .sort ...
```

What do you think is special about the ternary operator?

----------------------------------------
Bug #12929: ternary should look ahead w/in a block (and not care about newlines)
https://bugs.ruby-lang.org/issues/12929#change-61479

* Author: shawn wilson
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: 
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
foo = (bar ? 0 : 1) # works
foo = (bar ?
  0 : 1) # works
foo = (bar
  ? 0
  : 1) # doesn't work



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>