0
0

More than 1 year has passed since last update.

三項演算子

Last updated at Posted at 2022-02-03

if (a == b) {
b = 1;
} else {
b = 2;
}

b = a == b ? 1 : 2;

と書き換えられる。
可読性の向上が期待できる。

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