Search
 
SCRIPT & CODE EXAMPLE
 

ELIXIR

elixir defguard

defmodule SomeModule do
  defguard greater_than_five_less_than_nine_number(x) when x > 5 and x < 9

  @doc """
      iex> SomeModule.do_something(6)
      "It's greater than 5 and less than 9!"

      iex> SomeModule.do_something(3)
      "Not in the range :("
  """
  def do_something(num) when greater_than_five_less_than_nine_number(num) do
    "It's greater than 5 and less than 9!"
  end

  def do_something(_num) do
    "Not in the range :("
  end
end
Comment

PREVIOUS NEXT
Code Example
Elixir :: elixir string to atom 
Elixir :: elixir ecto query to sql 
Elixir :: elixir reverse list 
Elixir :: elixir fibonacci 
Elixir :: elixir eval ast 
Elixir :: elixir check is nil 
Elixir :: split list in elixir 
Elixir :: elixir enum map_every 
Scala :: scala match default 
Scala :: How to make immutable variable in scala 
Scala :: filter by timestamp scala 
Scala :: currying scala 
Actionscript :: Create menu group in Maximo 
Excel :: excel formula not updating after inserting rows 
Excel :: excel and 
Perl :: perl print array 
Perl :: perl exit loop example 
Pascal :: pascal while 
Powershell :: powershell remove node_modules 
Gdscript :: gdscript while loop 
Abap :: sap checkbox abap 
Assembly :: 64 bit assembly Hello world 
Assembly :: stick with it no download 
Javascript :: jquery vslidation remove spaces from input 
Javascript :: remove non letters from a string javascript 
Javascript :: window.reload 
Javascript :: javascript split and trim 
Javascript :: update node.js dependencies 
Javascript :: javascript to detect browser 
Javascript :: how to get element by title js 
ADD CONTENT
Topic
Content
Source link
Name
2+4 =