mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
Add description about compact assignment of functions
This commit is contained in:
parent
20f8f41ad5
commit
a6927f543c
@ -395,6 +395,10 @@ end
|
|||||||
|
|
||||||
add(5, 6) # => 11 after printing out "x is 5 and y is 6"
|
add(5, 6) # => 11 after printing out "x is 5 and y is 6"
|
||||||
|
|
||||||
|
# Compact assignment of functions
|
||||||
|
f_add(x, y) = x + y # => "f (generic function with 1 method)"
|
||||||
|
f_add(3, 4) # => 7
|
||||||
|
|
||||||
# You can define functions that take a variable number of
|
# You can define functions that take a variable number of
|
||||||
# positional arguments
|
# positional arguments
|
||||||
function varargs(args...)
|
function varargs(args...)
|
||||||
|
Loading…
Reference in New Issue
Block a user