Use [] to find tag! Example: [flutter, javascript]

Dart Basic Programming
Dart Basic Programming

Chapter 6

Logical Operator

remove_red_eye 2297 Times
spellcheck 358 Words, 1062 Characters

Logical operator is an operator that determines the truth by a combination of two or more variables. This logical operator is often used in validation,  if else code and so on.


Cheat Sheet


&&

AND (and)

Used to return a value when all values are true.

||

OR (or)

Used to return a value when either value is true.

!

NOT (not)

Used to produce a negation of truth


Code Example

Please run the code below on the dart pad.

void main(){
   bool a = true;
   bool b = false;
  
   print("&& AND");
   print(a&&b);
   print("\n|| OR");
   print(a||b);
   print("! NOT b");
   print(!b);
}


Or you can run the snippet below

If the snippet doesn't work, you can open it on this snippet

Okay, thank you, see you in the next article.

Next Article (If Else Statement)
Content Navigation