1
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.

概要

paiza.ioでelixirやってみた。
IO使ってみた。

サンプルコード


IO.chardata_to_string([0x00E6, 0x00DF])
|> IO.puts
IO.chardata_to_string([0x0061, "bc"])
|> IO.puts
IO.chardata_to_string("string")
|> IO.puts

IO.gets("What is your name?\n")
|> IO.puts

IO.inspect(<<0, 1, 2>>, width: 40)

[1, 2, 3]
|> IO.inspect(label: "before")
|> Enum.map(&(&1 * 2))
|> IO.inspect(label: "after")
|> Enum.sum()
|> IO.puts

IO.iodata_length([1, 2 | <<3, 4>>])
|> IO.puts

bin1 = <<1, 2, 3>>
bin2 = <<4, 5>>
bin3 = <<6>>
IO.iodata_to_binary([bin1, 1, [2, 3, bin2], 4 | bin3])
|> IO.inspect

bin = <<1, 2, 3>>
IO.iodata_to_binary(bin)
|> IO.inspect

IO.puts("Hello World!")
IO.write("sample")
IO.puts(:stderr, "error")

Enum.each(IO.stream(:stdio, :line), &IO.write(&1))

IO.warn("variable bar is unused")




実行結果

æß
abc
string
What is your name?
a

<<0, 1, 2>>
before: [1, 2, 3]
after: [2, 4, 6]
12
4
<<1, 2, 3, 1, 2, 3, 4, 5, 4, 6>>
<<1, 2, 3>>
Hello World!
samplehello


成果物

以上。

1
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
1
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?