help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: space vs semicolon - why syntax error with the former ? (octave-3.4.


From: Ben Abbott
Subject: Re: space vs semicolon - why syntax error with the former ? (octave-3.4.2)
Date: Tue, 16 Aug 2011 07:55:54 -0400

On Aug 16, 2011, at 7:25 AM, Sergei Steshenko wrote:

> Hello,
> 
> here is a screen session:
> "
> octave:1> for ii=1:1 ii endfor disp(ii)
> parse error:
> 
>  syntax error
> 
>>>> for ii=1:1 ii endfor disp(ii)
>                            ^
> 
> octave:1> for ii=1:1 ii endfor;disp(ii)
> ii =  1
> 1
> octave:2>
> ".
> 
> Why is it so 'octave' doesn't accept the first variant ?
> 
> With "traditional" 'endfor' on a new line semicolon isn't needed ?
> Is there any reason for newline whitespace to be treated differently than 
> space whitespace ?
> 
> Thanks,
>  Sergei.

The parser treats keywords and functions differently.

I am not familiar with the parser implementation, so I can't give a better 
explanation. To see what Octave's keywords are, you can use the undocumented 
function __keywords__.

To see what functions are in the path, use __list_functions__.  There are 
builtin function as well. To see those use __builtins__.

Ben



reply via email to

[Prev in Thread] Current Thread [Next in Thread]