Search
 
SCRIPT & CODE EXAMPLE
 

ELIXIR

elixir guard

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 try catch 
Elixir :: generate random number elixir 
Elixir :: jason elixir 
Elixir :: elixir enum flat_map 
Elixir :: ** (Ecto.ConstraintError) constraint error when attempting to insert struct: * id_fkey (foreign_key_constraint) 
Elixir :: elixir mapset member 
Elixir :: .t() elixir 
Elixir :: elixir pipeline 
Scala :: how to create empty data frame in scala 
Scala :: scala order list 
Scala :: scala in hadoop 
Scala :: map function scala 
Actionscript :: mass transit logging to seq 
Excel :: google sheets sort column by element frequency 
Excel :: AND logic in excel formula 
Perl :: perl for 
Perl :: perl rename a file 
Pascal :: pascal iteration 
Powershell :: powershell -executionpolicy bypass -file 
Gdscript :: godot 
Abap :: abap char variable 
Assembly :: javafx fxml loader example 
Assembly :: visual studio change assembly name 
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
5+2 =