Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
10
Task/Named-parameters/Wren/named-parameters.wren
Normal file
10
Task/Named-parameters/Wren/named-parameters.wren
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
var printName = Fn.new { |name|
|
||||
if (!(name is Map && name["first"] != null && name["last"] != null)) {
|
||||
Fiber.abort("Argument must be a map with keys \"first\" and \"last\"")
|
||||
}
|
||||
System.print("%(name["first"]) %(name["last"])")
|
||||
}
|
||||
|
||||
printName.call({"first": "Abraham", "last": "Lincoln"}) // normal order
|
||||
printName.call({"last": "Trump", "first": "Donald"}) // reverse order
|
||||
printName.call({"forename": "Boris", "lastname": "Johnson"}) // wrong parameter names
|
||||
Loading…
Add table
Add a link
Reference in a new issue