LoginSignup
1
0

|| 論理演算子でこれを使う場合

Posted at
 || 

の場合を考察

「||」はプログラミングではまたはを意味する

Aが真 || Bが偽

の場合はAが真のため条件全体はtrue

Aが偽 || Bが真

こちらもBが真であるためtrueが返る

A,Bどちらも真の場合はもちろんtrue
A,Bどちらも偽の場合はもちろんfalse

このように「||」は右辺か左辺のどちらかが真であれば条件全体がtrueとなる

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