title: Elixir - Multiple expressions on same line - Compiler error when using do: syntax in function definition
body: <p>In Elixir, multiple expressions can be delimited by semicolon (<code>;</code>).</p>
  
  <p>Elixir complains in below function definition </p>
  
  <pre><code>defmodule Module2 do
      def func([c], n), do: IO.inspect(c); c + n
  end
  </code></pre>
  
  <p>with error</p>
  
  <pre><code>** (CompileError) hello.exs:2: undefined function c/0
      (stdlib) lists.erl:1352: :lists.mapfoldl/3
      (stdlib) lists.erl:1352: :lists.mapfoldl/3
      (stdlib) lists.erl:1353: :lists.mapfoldl/3
  </code></pre>
  
  <p>However, Elixir is happy with below syntax.  </p>
  
  <pre><code>defmodule Module1 do
      def func([c], n) do 
          IO.inspect(c); c + n
      end
  end
  </code></pre>
  
  <p>I am not sure why one works over the other - as far as I understand both styles of function definition are equivalent.</p>
  
  <hr>
  
  <p>Complete code below for reference</p>
  
  <pre><code>defmodule Module1 do
      def func([c], n) do 
          IO.inspect(c); c + n
      end
  end
  defmodule Module2 do
      def func([c], n), do: IO.inspect(c); c + n
  end
  
  Module1.func('r', 13)
  Module2.func('r', 13)
  </code></pre>