Programming in Dart: Fundamentals

Apr 26 2022 · Dart 2.15, DartPad, DartPad

Part 1: Fundamentals

05. Use Logical Operators

Episode complete

Play next episode

Next
About this episode
Leave a rating/review
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 04. Challenge: Play with Booleans Next episode: 06. Set Conditional Values

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

In the previous set of exercises, you saw how you can work with Boolean values, and how you could use comparison operators such as less than, greater than, equal to and not equal to to compare values to each other.

const passingGrade = 50;
const studentGrade = 50;
const chrisGrade = 49;
const samGrade = 99;
const studentPassed = studentGrade >= passingGrade;
const chrisPassed = chrisGrade >= passingGrade;
const samPassed = samGrade >= passingGrade;
print(!samPassed);
print(!chrisPassed);
print(chrisPassed == false);
const catName = 'Jaspurr';
print(!catName);
// print(!catName);
// AND Operator
// &&
const bothPassed = chrisPassed && samPassed;
print(bothPassed);
// OR Operator
// ||
const eitherPassed = chrisPassed || samPassed;
print(eitherPassed);
const anyonePassed = chrisPassed || samPassed || studentPassed;
print(anyonePassed);
const anyonePassed = chrisPassed && samPassed && studentPassed;
print(anyonePassed);
const meritAwardGrade = 90;
const samHasPerfectAttendance = true;
const samIsMeritStudent = samHasPerfectAttendance && samGrade > meritAwardGrade;
print(samIsMeritStudent);