Question : elixir check type data
Answered by : nguyen-quang-huy
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 : https://stackoverflow.com/questions/28377135/how-do-you-check-for-the-type-of-variable-in-elixir | Last Update : Mon, 17 Jan 22