version 1.4, 2012/10/12 13:26:55
|
version 1.5, 2013/09/02 23:23:42
|
Line 3
|
Line 3
|
Variables can be used later in the same script. For instance, we can add |
Variables can be used later in the same script. For instance, we can add |
another line below the \texttt{\$variable} line as such: |
another line below the \texttt{\$variable} line as such: |
|
|
\$variable2~=~\$variable~+~2; |
\begin{verbatim} |
|
$variable2 = $variable+2; |
|
\end{verbatim} |
|
|
Now there is a variable called \texttt{\$variable2} with the the number {}``5'' |
Now there is a variable called \texttt{\$variable2} with the the number {}``5'' |
as its value. |
as its value. |
Line 14 large number of ways of using variables
|
Line 16 large number of ways of using variables
|
common way is to use normal double-quotes and just spell out the name of |
common way is to use normal double-quotes and just spell out the name of |
the variable you want to use in the string, like this: |
the variable you want to use in the string, like this: |
|
|
\$stringVar~=~{}``I~have~a~variable~with~the~value~\$variable.''; |
\begin{verbatim} |
|
$stringVar = "I have a variable with the value $variable."; |
|
\end{verbatim} |
|
|
This will put the string {}``I have a variable with the value 3.'' into |
This will put the string {}``I have a variable with the value 3.'' into |
the variable named {}``stringVar''. |
the variable named {}``stringVar''. |