OPERATOR: =
=
The operator is used to assign a value to a variable, or to compare strings and numbers,
or to print out the value of a variable.
When used for assignment, a single variable on the left side of the = operator is given the value determined
by one or more variables and/or expressions on the right side.
Code:
<% mynumber = 5.0 + 7.9*(444.999 / 456.9) %>
<% mystring = "The moon is 2160 miles in diameter." %>
<% myvar = xxx + yyy + zzz %>
<% myarray(40) = 12345 %>
The = operator can also compare two strings or two numbers and see if they are
the same. For strings, the comparison is case sensitive.
Code:
<% ="Apple"="Apple" %>
<% ="aPPle"="ApplE" %>
<% =123=123 %>
<%
=5.67=98.7 %>
Output:
True
False
True
False
When the = operator is used to print out the value of a variable,
the statement must be enclosed by its own set of <% %>.
There can blank spaces between the = operator and the variable.
Code:
<% myfish = "Neon tetra" %>
<% =myfish %>
<% = myfish
%>
Output:
Neon tetra
Neon tetra