Project

General

Profile

Actions

Feature #16045

closed

Calling functions with keyword arguments

Added by D1mon (Dim F) over 5 years ago. Updated over 5 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-core:94142]

Description

Python:

def fn(a=1,b=2,c=3):
    print(a,b,c)

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

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

Actions #2

Updated by D1mon (Dim F) over 5 years ago

def fn(a:1,b:2,c:3)
  p a,b,c
end
fn(c:4) # 1 2 4

did not know. can close

Actions

Also available in: Atom PDF

Like0
Like0Like0