4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Elixirの対話モードでパイプ演算子の動作を確認してみた

Posted at

概要

Elixirの対話モードでパイプ演算子の動作を確認してみました。以下のページを参考にしました。

対話モードで実行

以下のコマンドを実行しました。

$ iex
Erlang/OTP 24 [erts-12.2.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit]

Interactive Elixir (1.12.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> "Elixir rocks" |> String.split()
["Elixir", "rocks"]
iex(2)> "Elixir rocks" |> String.upcase() |> String.split()
["ELIXIR", "ROCKS"]
iex(3)> "elixir" |> String.ends_with?("ixir")
true
iex(4)> "elixir" |> String.ends_with? "ixir"
warning: parentheses are required when piping into a function call. For example:

    foo 1 |> bar 2 |> baz 3

is ambiguous and should be written as

    foo(1) |> bar(2) |> baz(3)

Ambiguous pipe found at:
  iex:4

true
iex(5)> 

まとめ

何かの役に立てばと。

4
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
4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?