Created
October 8, 2015 16:37
-
-
Save x4lldux/7ec759a00af65612cd71 to your computer and use it in GitHub Desktop.
Elixir function definition with default args
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule A do | |
def f(a \\ "a", b, c \\ "c", d \\ "d") do | |
IO.inspect a | |
IO.inspect b | |
IO.inspect c | |
IO.inspect d | |
IO.puts "####\n" | |
end | |
end | |
A.f "1" | |
A.f "1", "2" | |
A.f "1", "2", "3" | |
A.f "1", "2", "3", "4" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this will output: