|
From: | Przemek Klosowski |
Subject: | Re: space vs semicolon - why syntax error with the former ? (octave-3.4.2) |
Date: | Tue, 16 Aug 2011 14:33:55 -0400 |
User-agent: | Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20110707 Thunderbird/5.0 |
On 08/16/2011 01:52 PM, Sergei Steshenko wrote:
this case - to me it looks like the 'for' loop statement is unambiguously over, and no special separator (e.g. ';') is necessary
--- On Tue, 8/16/11, CdeMills<address@hidden> wrote:Sorry, but taking your reasoning literally is bogus: let's consider if (0>1) disp('Problem'); end; disp(36) if you take for granted that the 'end' close the expression, then then previous line should be equivalent to ; disp(36) which is a syntactically incorrect.
Normal languages do not care about semicolon before a function call.
There is no such thing as a 'normal language' in this respect. Look up the debate that raged in the nineties on whether semicolon should be a separator or a terminator. One doesn't have to look far, this is covered in Wikipedia:
http://en.wikipedia.org/wiki/Comparison_of_programming_languages_%28syntax%29There are arguments for either style, and the debate ended in a tie---it appears that the score among the languages listed in the Wikipedia article is 24:21.
Matlab happens to be one of the few languages with both a primary (newline) and secondary (';,') separator---probably to make it easier for command line coding; they also overloaded the semicolon to control output silencing. It is what it is, let's get on with it :)
[Prev in Thread] | Current Thread | [Next in Thread] |