Learn
Traditional arithmetic operations are supported on numeric types in LOLCODE:
BTW Addition SUM OF x AN y BTW Subtraction DIFF OF x AN y BTW Multiplication PRODUKT OF x AN y BTW Division QUOSHUNT OF x AN y
Let’s start with the two most basic:
SUM OF
: Creates the sum ofx
andy
(equivalent tox + y
in most languages)DIFF OF
: Subtractsy
fromx
(equivalent tox - y
in most languages)
If either number in an operation is a NUMBAR
, the result will be too. Otherwise the result will be a NUMBR
.
BTW equates to 7 SUM OF 3 AN 4
Multiple operations can be within the same statement, and will follow the traditional order as with other programming languages.
BTW equates to 5 DIFF OF SUM OF 3 AN 4 AN 2
Instructions
1.
Print out the sum of 1
and 2
.
2.
Print the result of adding 7 to the difference of 70 and 13.
Take this course for free
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.