LoginSignup
0
0

More than 5 years have passed since last update.

Elixir Underscore #elixir

Posted at

Elixir Underscore

概要

Elixir の Underscore について。

Elixir では関数に未使用の引数があると警告が発生します。

defmodule Hoge do
  def hoge(hoge, hige) do
    hige
  end
end

IO.puts Hoge.hoge("hoge", "hige")
  • 出力
underscore.exs:2: warning: variable hoge is unused
hige

引数名をアンダースコアから始めると警告対象外になります

defmodule Hige do
  def hige(_hoge, hige) do
    hige
  end
end

IO.puts Hige.hige("hoge", "hige")
  • 出力
hige
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0