Modelica条件打印(用于调试)

mat*_*tth 1 debugging if-statement modelica

在Modelica中,是否可以在一行中使用if条件和命令?
(当然可以将它写成三行,但我更喜欢它在一行中.)
类似于:

Boolean verbose;
...
if verbose then Modelica.Utilities.Streams.print("iteration steps " + String(iter), "printlog.txt");
Run Code Online (Sandbox Code Playgroud)

sjo*_*.se 5

你写的代码有什么问题?我发现唯一遗漏的是结束.

if cond then print(str, file); end if;