From c45cc8d16fbaa187517ee31548ffbace62151533 Mon Sep 17 00:00:00 2001 From: Andrea Leopardi Date: Mon, 18 Apr 2016 09:30:11 +0200 Subject: [PATCH] Fix the output of some examples in the "Case, cond and if chapter" --- getting-started/case-cond-and-if.markdown | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/getting-started/case-cond-and-if.markdown b/getting-started/case-cond-and-if.markdown index 6bba42184..628b6ea5b 100644 --- a/getting-started/case-cond-and-if.markdown +++ b/getting-started/case-cond-and-if.markdown @@ -251,7 +251,7 @@ One thing to keep in mind when using `do/end` blocks is they are always bound to iex> is_number if true do ...> 1 + 2 ...> end -** (RuntimeError) undefined function: if/1 +** (CompileError) undefined function: is_number/2 ``` Would be parsed as: @@ -260,10 +260,10 @@ Would be parsed as: iex> is_number(if true) do ...> 1 + 2 ...> end -** (RuntimeError) undefined function: if/1 +** (CompileError) undefined function: is_number/2 ``` -Which leads to an undefined function error as Elixir attempts to invoke `if/1`. Adding explicit parentheses is enough to resolve the ambiguity: +which leads to an undefined function error as Elixir attempts to invoke `is_number/1`, but passing it *two* arguments (the `if true` expression - which would throw an undefined function error itself as `if` needs a second argument, the `do/end` block - and the `do/end` block). Adding explicit parentheses is enough to resolve the ambiguity: ```iex iex> is_number(if true do