Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Return

Here returns the return!

Installation

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.

Example

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

TODO

  • Make anonymous functions that support return
  • More tests

About

No description, website, or topics provided.

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages