Computer Science I / Conditionals and Logical Branching
Practice question · Sort into groups

Sort each operator by its role.

Groups: Comparison operator · Boolean operator · Assignment operator

Hints
  1. Comparisons produce a boolean; boolean operators combine booleans; assignment stores a value.
  2. The single = is not a comparison at all, however much it looks like one.
Show the answer

Comparison operator: ==, !=,

=

Boolean operator: and, or

Assignment operator: =

Why

== , != and >= compare and yield true or false; 'and' and 'or' combine booleans; the single = assigns. Filing = under comparison is exactly the bug the lesson warns about: writing = where == is meant tries to assign inside a condition.

Read the lesson: Conditionals and Logical Branching →

Practise Conditionals and Logical Branching

The app has 6 more questions on this lesson, and keeps your place in the course. Computer Science I is free to start.

More questions on Conditionals and Logical Branching