Skip to content

Commit

Permalink
Minor cleanup for for-equation listings
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikt-ma committed May 10, 2022
1 parent ee0cc90 commit 7d68750
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions chapters/equations.tex
Expand Up @@ -115,7 +115,7 @@ \subsubsection{Explicit Iteration Ranges of For-Equations}\label{explicit-iterat
for r in 1.0 : 1.5 : 5.5 loop // r takes the values 1.0, 2.5, 4.0, 5.5
for i in {1, 3, 6, 7} loop // i takes the values 1, 3, 6, 7
for i in TwoEnums loop // i takes the values TwoEnums.one, TwoEnums.two
// for TwoEnums = enumeration(one,two)
// for TwoEnums = enumeration(one, two)
\end{lstlisting}

The loop-variable may hide other variables as in the following example.
Expand All @@ -124,8 +124,8 @@ \subsubsection{Explicit Iteration Ranges of For-Equations}\label{explicit-iterat
constant Integer j = 4;
Real x[j]
equation
for j in 1:j loop // The loop-variable j takes the values 1,2,3,4
x[j] = j; // Uses the loop-variable j
for j in 1 : j loop // j takes the values 1, 2, 3, 4
x[j] = j; // Uses the loop-variable j
end for;
\end{lstlisting}
\end{example}
Expand All @@ -138,10 +138,11 @@ \subsubsection{Implicit Iteration Ranges of For-Equations}\label{implicit-iterat

\begin{example}
\begin{lstlisting}[language=modelica]
Real x[n],y[n];
for i loop // Same as: for i in 1:size(x ,1) loop
x[i] = 2*y[i];
end for;
Real x[n], y[n];
equation
for i loop // Same as: for i in 1 : size(x, 1) loop
x[i] = 2 * y[i];
end for;
\end{lstlisting}
\end{example}

Expand Down

0 comments on commit 7d68750

Please sign in to comment.