Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

is it possible to put in a loop"for" an equation and an algorithm?

is it possible to put in a loop"for" an equation and an algorithm?

Hello there,
I need to write an equation and an algorithm (to assign a value to a variable) inside a for loop
is that possible?

for example something like that

for i: in 2: N loop
equation
der(s(i))=s(i)+a;
algorithm
a:=a+s;
end for;

I don't know when I try to compile itwhy I have some errors on the tags algorithm and end for.

Any suggestion?

Re: is it possible to put in a loop"for" an equation and an algorithm?

No, it is not possible to put an equation or algorithm section within the statements of a for-loop. The code won't even parse, which means the error messages will be really weird.

There are 0 guests and 0 other users also viewing this topic
You are here: