You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 3 - Functional Programming/1.1 - Variables.tex
+67-1Lines changed: 67 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -44,7 +44,73 @@ \subsection{Data Types}
44
44
variable on declaration (unlike our sudo language).
45
45
46
46
47
-
\subsection{Operations}
47
+
\subsection{Operators}
48
+
Operators are symbols we can use to manipulate variables.
49
+
There are a few different types of operators, Arithmetic, Comparison and Logical operators.
50
+
A quick list of operators include:
51
+
52
+
\begin{enumerate}
53
+
\item Addition +
54
+
\item Subtraction -
55
+
\item Multiplication *
56
+
\item Division /
57
+
\item Equals =
58
+
\item Equal To ==
59
+
\item Not Equal To !=
60
+
\item Less Than <
61
+
\item Greater Than >
62
+
\item Logical AND \&\&
63
+
\end{enumerate}
64
+
65
+
And there are more!
66
+
\par
67
+
68
+
Arithmetic operators include the mathematical symbols for addition (+), subtractions (-), division(/), multiplication(*) and equals(=).
69
+
These operators are used to directly manipulate and change variables.
70
+
For example we can add two variables together and then store that sum into a third variable.
71
+
72
+
\begin{lstlisting}[caption={Addition Operator}]
73
+
a = 10
74
+
b = 5
75
+
c = a + b
76
+
77
+
print c
78
+
\end{lstlisting}
79
+
80
+
We store the value of \pigVal{10} into the variable \pigVar{a} and the value \pigVal{5} into the variable \pigVar{b}.
81
+
Lastly, we store the sum of the variables \pigVar{a} and \pigVar{b} into the variable \pigVar{c}.
82
+
The output of this program will be \pigOut{15}.
83
+
\par
84
+
85
+
Comparison operators are used to compare variables against other variables or values.
86
+
The output of a comparison operator will be a boolean value (\pigVal{true} or \pigVal{false}).
87
+
Some of the popular comparison operators are the equals to (==), not equals to (!=), less than (<), less than equal to (<=), greater than (>) and greater than equal to (>=).
0 commit comments