Issue #15921 has been updated by ioquatix (Samuel Williams).


There are two areas where I think this is a great addition:

```ruby
x = if foo
	bar
else
	baz
end

if foo
	bar
else
	baz
end => x
```

I prefer the latter, because it avoids messing with the indentation/readability of the `if` expression.

Additionally, sometimes I find using `irb` I have made very large expression. In terminal, going to start of line isn't always obvious/easy. So, I wish to save expression, usually I just press enter and then write `x = _` to save last result. But when I go back in history to execute statement again, I must make same "hack". So, I wish I can just write:

```
very long query to get list of users => users
````

That way I don't need to think so hard or go back to start of statement. It might also be nice in middle of expressions, e.g. 

```
Users.where(active: true) => active_users.where(type: "admin") => admin_users
```

I don't know if such usage is possible or anticipated, I just wanted to show some ideas - for long expressions sometimes I want to check the middle of the expression.

----------------------------------------
Feature #15921: R-assign (rightward-assignment) operator
https://bugs.ruby-lang.org/issues/15921#change-78610

* Author: nobu (Nobuyoshi Nakada)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
From https://bugs.ruby-lang.org/issues/15799#change-78465, proposal of the rightward-assignment operator by `=>`.

```
$ ./ruby -v -e '(1..).lazy.map {|x| x*2} => x' -e 'p x.first(10)'
ruby 2.7.0dev (2019-06-12T06:32:32Z feature/rassgn-assoc c928f06b79) [x86_64-darwin18]
last_commit=Rightward-assign by ASSOC
[2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
```

https://github.com/nobu/ruby/tree/feature/rassgn-assoc



-- 
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>