#87 – Relational Operators

The relational operators (<, >, <=, >=) are used to compare the values of two operands and return a boolean value based on comparing the values of the operands.

  • <       Returns true if the 1st operand is less than the 2nd
  • <=    Returns true if the 1st operand is less than or equal to the 2nd
  • >       Returns true if the 1st operand is greater than the 2nd
  • >=    Returns true if the 1st operand is greater than or equal to the 2nd

The relational operators are typically used on numeric operands (e.g. float, int).  You can also compare objects of type char and enum type members.  More generally, the operators will be available for objects of any type that implements the relational operators.

Advertisement

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: