Search
 
SCRIPT & CODE EXAMPLE
 

ELIXIR

elixir function guards

defmodule Greeter do
  def hello(names) when is_list(names) do
    names = Enum.join(names, ", ")
    
    hello(names)
  end

  def hello(name) when is_binary(name) do
    phrase() <> name
  end

  defp phrase, do: "Hello, "
end

iex> Greeter.hello ["Sean", "Steve"]
# "Hello, Sean, Steve"
Comment

PREVIOUS NEXT
Code Example
Elixir :: elixir with else 
Scala :: scala reverse list 
Scala :: scala list get element 
Scala :: scala read lines from file 
Scala :: scala Datetime parse 
Scala :: sum type scala 
Scala :: scala home set up 
Scala :: scala schema json spark 
Actionscript :: iis appcmd stop site 
Actionscript :: add to github 
Excel :: google sheets sort column by item frequency 
Excel :: excel or formula 
Perl :: perl regex 
Perl :: Move files to new directory 
Pascal :: pascal read 
Pascal :: pascal cheat sheet pdf 
Powershell :: powershell replace character in string 
Gdscript :: gdscript vector2 
Abap :: adobre forms abap tcode 
Assembly :: jinja loop index 
Assembly :: cout boolalpha 
Assembly :: how to check whether a row contains a numeric value or not in df 
Javascript :: jquery vslidation remove spaces from input 
Javascript :: datatable disable searching 
Javascript :: js random hex color 
Javascript :: WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for jquery 
Javascript :: jquery slim min js url 
Javascript :: js element exists 
Javascript :: select2 in modal not work 
Javascript :: angular validators number only in reactive form 
ADD CONTENT
Topic
Content
Source link
Name
5+3 =