Overload Operators and Expressions
Overloaded Operators and Relational, Boolean and Conditional Expressions
Overloaded Operators
You may notice that certain operators like the “+” sign are always being used. This is called operator overloading. Some programmers find this good while others find it confusing. Operator overloading can be advantageous because a single operator can do so many things. For instance, in some programming languages, the “+” sign can increment, add, and concatenate, to mention a few. It can be disadvantageous because sometimes the programmer and the computer mix up its functionality. Sometimes you don't know what an operator will do. You will only know after the program has been finished or during debugging sessions.
Relational Expressions
Relational expressions tell you how one operand relates to another.The “<” sign tells you that the first operand is “less than” the second operand. The“>” sign tells you that the first operand is “greater than” the second operand. The “= ” sign tells you that the first operand is “equal to” the second operand. The“<>” sign tells you that the first operand is “not equal to” the second operand. The “<=” sign tells you that the first operand is “less than or equal to” the second operand. The “>=” sign tells you that the first operand is “greater than or equal to” the second operand.
Boolean and Conditional Expressions
Conditional expressions allow action only under given circumstances or situations. These follow the sequence if – then. If these are the following condition and they are met then these are the actions that have to be done. You can also add up conditions in order to have several ones before execution. You can have two or more conditions before prompting action. Aside from the if – then sequence, there is also the if – then – else sequence. Depending on the programmer, if conditions are met or unmet, the if – then – else sequence will execute accordingly. These sequences will be discussed further in Chapter 6.
You can make an if-then statement with the Visual Basic Editor. Use the program that you created awhile ago and type in If Boys > Girls Then MsgBox "Too Many Boys" Else MsgBox "Too Many Girls".