Here returns the return
!
If available in Hex, the package can be installed
by adding return
to your list of dependencies in mix.exs
:
def deps do
[{:return, "~> 0.0.1"}]
end
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/return.
defmodule MyModule do
use Return
func simple do
if 1 == 1, do: return "It's true"
IO.puts "This message will never be printed"
end
func function_with_params_and_guard(x, y) when is_integer(x) and is_integer(y) do
if rem(x, y) == 0, do: return :ok
:error
end
funcp private_function do
return :ok
IO.puts "This message will never be printed"
end
end
- Make anonymous functions that support
return
- More tests