Welcome! Today, we will traverse the galaxy of TypeScript arithmetic and logical operations. Arithmetic operations, similar to basic mathematics, help us conduct simple calculations. Logical operations, on the contrary, assist us in evaluating conditions and making decisions. They act as game controllers, steering your character's next action based on the current circumstances.
Suppose you were in a toy store with only $20
at hand, and each toy was priced at $5
. Most likely, you would perform a division operation to determine how many toys you could afford. But what if you wanted to buy a board game ($7
) and a puzzle ($6
) with your $20
? Logical operations would then come into play, helping you make the right decision. Let's explore!
Arithmetic operations in TypeScript are simple and bear a strong resemblance to those in basic mathematics. We use +
for addition, -
for subtraction, *
for multiplication, /
for division, %
for determining the remainder of a division, and for exponentiation.
