Skip to content

Commit

Permalink
Turn two listings into separate examples, and add short introductions
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikt-ma committed Dec 13, 2022
1 parent e0bd3cb commit d609eb2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions chapters/statements.tex
Expand Up @@ -207,6 +207,7 @@ \subsubsection{Implicit Iteration Ranges}\label{implicit-iteration-ranges}
The \lstinline!IDENT! may also be used as a subscript for an array in a component of an expandable connector but it is only seen as a reference to the variable \lstinline!IDENT! and cannot be used for deducing ranges.

\begin{example}
Implicit iterator ranges for an \lstinline!Integer! subscript:
\begin{lstlisting}[language=modelica]
Real x[4];
Real xsquared[:] = {x[i] * x[i] for i};
Expand All @@ -222,9 +223,14 @@ \subsubsection{Implicit Iteration Ranges}\label{implicit-iteration-ranges}
xsquared3[i] := x[i]^2;
end for;
\end{lstlisting}
\end{example}

\begin{example}
An array dimension's type of subscript does not matter for array compatibility, only the size of the array dimension matters.
This is true also for array constructor expressions with implicit iterator ranges:
\begin{lstlisting}[language=modelica]
type FourEnums = enumeration(one, two, three, four);
Real x[4];
Real xe[FourEnums] = x;
Real xsquared3[FourEnums] = {xe[i] * xe[i] for i};
Real xsquared4[FourEnums] = {xe[i] * xe[i] for i in FourEnums};
Expand Down

0 comments on commit d609eb2

Please sign in to comment.