New course! Every coder should learn Generative AI!
Try a free lesson+ 8
Unary minus is used to denote negative numbers, and only has 1 operand (the number/variable to make negative). Ex: If the variable answer is 7, -answer returns -7.
The subtraction operator needs 2 operands, the number to subtract from, and the amount to subtract.
They're made district depending on spacing and the number of operands.