Functions and Operators
Explore the differences between functions and operators and learn to write your own operators.
We'll cover the following...
After the quite challenging material of the last lessons, we wrap up this section with a few more lightweight lessons on additional syntax, starting with operators.
Functions vs. operators
So far in this course, we have differentiated between functions (like div
or mod
) and operators (like +
or *
). The apparent difference between them is that:
- Functions are used in prefix notation – the function name precedes the arguments (e.g.,
mod 5 2
). - Operators are used in infix notation – the operator is between its arguments (e.g.,
3 + 5
).
Because of the infix notation, operators can only take two arguments, while functions can take any number. ...
Access this course and 1400+ top-rated courses and projects.