LoginSignup
13
2

More than 1 year has passed since last update.

今日のElixirSchoolメモ1「基本」

Last updated at Posted at 2022-10-29

本記事はElixir Schoolの学習メモです。
気になることが増えたら追記します。

ブール演算子

「ブール演算子(and,or,not)」と「ゆるいブール演算子(||,&&,!)があって、前者は最初の引数はtrueかfalseのみ指定できます。

iex(15)> true and 42
42
iex(16)> 42 and true
** (BadBooleanError) expected a boolean on left-side of "and", got: 42

iex(16)> not false
true
iex(17)> not 42
** (ArgumentError) argument error
    :erlang.not(42)

比較

型が同じか互換性がない場合、次のルールに従って比較が行われる
number < atom < reference < function < port < pid < tuple < map < list < bitstring

iex(17)> :hello > 999
true
iex(18)> {:hello, :world} > [1, 2, 3]
false
13
2
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
13
2