Often you want to compare a value of one variable with one of another variable, or the value of a variable against a literal value, for example the value in an if-statement.
An example of a comparison: if you want to compare the value of the day of the week to “Sunday”, you can do this by checking todaysDate == "Sunday".
Don’t mix up = with ==, the first is an assignment, the second one is a comparison.
Comparisons:
x == y– true if x and y are equalx != y– true if x and y are not equalx > y– true if x is greater than yx >= y– true if x is greater or equal to yx < y– true if x is less than yx <= y– true if x is less or equal to yx && y– true if x and y are truex || y– true if x or y are true!x– true if x is false