User Tools

Site Tools


programming:elixir:hello_world

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
programming:elixir:hello_world [2023/04/26 13:26] ateixeiraprogramming:elixir:hello_world [2023/05/02 14:52] (current) ateixeira
Line 65: Line 65:
 [1, _, 3] = [1, "toto", 3] [1, _, 3] = [1, "toto", 3]
 # => [1, "toto", 3] # => [1, "toto", 3]
 +</code>
 +
 +==== Sigils ( symbols with magical powers ) ====
 +
 +>A sigil is an alternative syntax for representing and working with literals
 +
 +>A sigil starts with a tilde (~), followed by an upper- or lowercase letter, some delimited content, and perhaps some options
 +
 +> The delimiters can be <...>, {...}, [...], (...), |...|, /.../, "...", and '...'
 +
 +<code elixir>
 +The letter determines the sigil’s type:
 +
 +~C  A character list with no escaping or interpolation
 +~c  A character list, escaped and interpolated just like a single-quoted string
 +~D  A Date in the format yyyy-mm-dd
 +~N  A naive (raw) DateTime in the format yyyy-mm-dd hh:mm:ss[.ddd]
 +~R  A regular expression with no escaping or interpolation
 +~r  A regular expression, escaped and interpolated
 +~S  A string with no escaping or interpolation
 +~s  A string, escaped and interpolated just like a double-quoted string
 +~T  A Time in the format hh:mm:ss[.dddd]
 +~W  A list of whitespace-delimited words, with no escaping or interpolation
 +~w  A list of whitespace-delimited words, with escaping and interpolation
 </code> </code>
  
programming/elixir/hello_world.1682515599.txt.gz · Last modified: 2023/04/26 13:26 by ateixeira