Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR ELIXIR

elixir check type data

defmodule Util do
    def typeof(a) do
        cond do
            is_float(a)    -> "float"
            is_number(a)   -> "number"
            is_atom(a)     -> "atom"
            is_boolean(a)  -> "boolean"
            is_binary(a)   -> "binary"
            is_function(a) -> "function"
            is_list(a)     -> "list"
            is_tuple(a)    -> "tuple"
            true           -> "idunno"
        end    
    end
end
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #elixir #check #type #data
ADD COMMENT
Topic
Name
2+2 =