View Single Post
Old 26th March 2013, 12:09   #2  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Yes, that's right.
Newline (unless accompanied by a '\') always terminates the current statement, but it is not strictly necessary.
The Avisynth parser recognises it has reached the end of a statement when the next symbol is not a valid continuation of what it already has. So
Code:
x = 1  y = 2  z = 3
is parsed as three separate (assignment) statements.

Although it is conventional to use newlines to separate statements (and good practice for readability), the syntax is such that it is only strictly necessary if the following statement starts with a unary minus (or plus) operator - not very common, but can occur in cases like (silly example!):
Code:
function f(int x, int y) {
  z = x + y
  - z # meaning return -z 
}
Here '- z' must appear on a separate line, since the previous statement could validly be continued with a '-'.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote