Mix format with default function params

Hello everyone,
This is my first time at elixir forum, sorry if this isn’t’ the correct way of talk about my problem, anyway I’m glad to talk here and work with this amazing language that I’m loving day after day.

Environment

  • Elixir & Erlang/OTP versions (elixir --version): elixir 1.9.1-otp-22 / erlang 22.0
  • Operating system: Arch Linux with asdf

Current behavior

defp valid?(blockchain, previous_block_hash // nil) do

mix format

defp valid?(blockchain, previous_block_hash(/ / nil)) do

Expected behavior

defp valid?(blockchain, previous_block_hash // nil) do

mix format

defp valid?(blockchain, previous_block_hash // nil) do
1 Like

For default arguments you need to use backslashes, not forward slashes.

So it should look like this:
defp valid?(blockchain, previous_block_hash \\ nil) do

6 Likes