Simple Integer.is_even(10) raises error

I’m just getting an error like below. Running Erlang 24.2 and Elixir 1.13.1

iex(9)> Integer.is_even(10)
** (UndefinedFunctionError) function Integer.is_even/1 is undefined or private. However there is a macro with the same name and arity. Be sure to require Integer if you intend to invoke this macro
(elixir 1.13.1) Integer.is_even(10)

Is this known issue?


Did you include require Integer in the file (or type it into iex)?

explanation here: alias, require, and import - The Elixir programming language


Good catch. ‘require Integer’ did a trick

1 Like

I find it "odd " that I have to require Integer. If I use String I do not need to require, I guess that’s the confusing bit.

is_even/is_odd are guards, which can also be used in guard clauses. That’s the difference.

1 Like

aha, thx