Octave: same line if + more

I get a syntax error for the following line in octave 3.6.2:

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

a

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

It looks normal. Nonetheless:

 if(exist('OCTAVE_VERSION')~=0) fflush(stdout); end 

It works beautifully.

Is this an error (?) Related to the argument in parentheses anymore?

thanks

+4
source share
1 answer

I also got the same results in Octave 3.4.3:

This seems to be a harmless compiler error in the octave, when you use the 'more off' or 'more on' command inside the 1 line if statement, a syntax error is generated.

If you add a new line after the conditional expression, or if you surround the β€œmore” inside eval (...), then it works correctly.

 %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 

Syntax error: "error: parsing error while reading the script file."

+3
source

All Articles