Skip to content

Aetherus/return

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

Watchers

Forks

Packages

No packages published

Languages