Tuple syntax For Elixir - Computer Programming

Latest

C C++ Java Python Perl Programs Examples with Output -useful for Schools & College Students

Thursday, September 28, 2017

Tuple syntax For Elixir

This shows the literal syntax to create a tuple and also how to pattern match.

Program:

{:ok, 1, "a"}

# pattern match
{:ok, result} = {:ok, "good"}

# this raises a match error
{:ok, result} = {:ok, "good", "one more"}

# empty tuple
{}

No comments:

Post a Comment