[ruby-core:78114] [Ruby trunk Bug#12929] ternary should look ahead w/in a block (and not care about newlines)
From:
duerst@...
Date:
2016-11-14 04:39:10 UTC
List:
ruby-core #78114
Issue #12929 has been updated by Martin D端rst.
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>