If statement 倍频程:如果+;更多

If statement 倍频程:如果+;更多,if-statement,octave,If Statement,Octave,我在octave 3.6.2中得到了以下行的语法错误: if(exist('OCTAVE_VERSION')~=0) more off; end 而: if(exist('OCTAVE_VERSION')~=0) more off; end 看起来不错。然而: if(exist('OCTAVE_VERSION')~=0) fflush(stdout); end 效果很好 这是一个bug(?)与more的非括号参数有关吗 谢谢我在倍频程3.4.3中也得到了同样的结果: 在octave中似乎

我在octave 3.6.2中得到了以下行的语法错误:

if(exist('OCTAVE_VERSION')~=0) more off; end
而:

if(exist('OCTAVE_VERSION')~=0)
 more off;
end
看起来不错。然而:

if(exist('OCTAVE_VERSION')~=0) fflush(stdout); end
效果很好

这是一个bug(?)与more的非括号参数有关吗


谢谢

我在倍频程3.4.3中也得到了同样的结果:

在octave中似乎是一个无害的编译器错误,当您在1行if语句中使用命令“more off”或“more on”时,会引发语法错误

如果在条件后面添加换行符,或者在eval(…)中环绕“more off”,则它可以正常工作

%works correctly, turns off paging screen output
if(1)
  more off;
end

%works correctly, prints 3.4.3
if(1) disp(OCTAVE_VERSION);  end

%works correctly, prints '1'
if(1) disp([1]); more off;  end

%syntax error when parsing "off" in 'more off'.
if(1) more off; endif

%syntax error on parsing 'off' in 'more off;'
if 1 more off;  endif

%works correctly, turns off paging screen output
if (1) eval("more off"); endif
抛出的语法错误是:“错误:读取脚本文件时解析错误”