Skip to content

Latest commit

 

History

History
30 lines (24 loc) · 383 Bytes

counter.livemd

File metadata and controls

30 lines (24 loc) · 383 Bytes

Elixir Notes

CRC Counter

defmodule Counter do
  def new(string) do
    String.to_integer(string)
  end

  def add(counter, value \\ 1) do
    counter + value
  end

  def show(counter) do
    "The ans-ARRRR is #{counter}"
  end
end
input = "42"

input 
|> Counter.new() 
|> Counter.add(1) 
|> Counter.add(1) 
|> Counter.add(-1) 
|> Counter.show()