Talk:Comparison of programming languages (syntax)
=begin
Block comment =end
I've tried, it doesn't work in Perl. It ignores everything after the "=end". I've read that Perl requires "=cut" to finish POD block. May be that way will work better:
=comment Block comment =cut
91.149.147.166 12:14, 20 August 2007 (UTC)
is C semicolon terminated?
i really doubt it is true. at leas generally. for
if(0) { }
and
if(0) {} else {}
are valid. in contrast to
if(1) ;
84.16.123.194 (talk) 16:55, 25 February 2008 (UTC)
- C's compound statement is an exception to the rule. Such exceptions are pretty common. You could say Pascal is a period-terminated-statement language because of the
end.
to end the program. BrentDT (talk) 21:21, 10 March 2008 (UTC)
int main()
{
if(3==3)
printf("one\n"),printf("two\n");
else
printf("three\n"),printf("four\n");
return 0;
}
Will output "one\ntwo\n"
. Comma separates expressions, semicolon terminates statements. A curly bracketed block is a terminated statement in itself. Notinlist (talk) 14:01, 18 October 2010 (UTC)
Contradiction
The ABAP article says "The only requirement is that every statement ends in a period." This article says it's period-separated. Which is true? BrentDT (talk) 21:38, 10 March 2008 (UTC)
Triple-quoted strings are sometimes used for comments in Python, but I've never seen that in Ruby. It wouldn't make sense either, because the interpreter will parse and evaluate/interpolate the string -- it could even have side effects. A comment is a sequence of characters that is completely ignored by the interpreter/compiler.--87.162.35.138 (talk) 20:06, 17 March 2010 (UTC)
Newline termination and continuation
A number of the newline terminated languages can properly detect when a statement spans lines. This is independent of their formal line-continuation syntax. The article doesn't address this and implies a newline will always terminate the statement (barring the line-continuation symbol).
The languages I am familiar with detect this by determining that a line is not syntactically valid on its own, but is when combined with one or more following lines. Or alternatively, they detect it when a line ends (whitespace excluded) with a character that requires an additional term (such as a binary mathematical operator).
Eiffel and Ruby are two such languages.