[ruby-core:94145] [Ruby master Feature#16045] Calling functions with keyword arguments

From: FreeKMan@...
Date: 2019-08-05 07:10:43 UTC
List: ruby-core #94145
Issue #16045 has been updated by D1mon (Dim F).


``` ruby
def fn(a:1,b:2,c:3)
  p a,b,c
end
fn(c:4) # 1 2 4
```
did not know. can close

----------------------------------------
Feature #16045: Calling functions with keyword arguments
https://bugs.ruby-lang.org/issues/16045#change-80392

* Author: D1mon (Dim F)
* Status: Rejected
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
Python:
``` python
def fn(a=1,b=2,c=3):
    print(a,b,c)

fn() # 1 2 3
fn(c=4) # 1 2 4
```


Ruby:
``` ruby
def fn(a=1, b=2, c=3)
  p a,b,c  
end

fn(c=4) # 4 2 3
```

A very convenient and necessary thing that you must add in Ruby!?



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

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

In This Thread

Prev Next