If the shell is in interactive mode, writing
for (var i = 0; i < 10; i++)
will prematurely send the line to V8 for execution, which then returns
SyntaxError: Unexpected end of input
because of the missing body.
However, if one writes
for (var i = 0; i < 10; i++) { // notice open { at end
it will correctly prompt for the body of the loop.
The shell should detect the missing body and also wait for the next statement.
- is related to
-
SERVER-13401 Javascript (2 issues): loop variable evaluation error
- Closed
-
SERVER-13934 Escaping of parentheses/brackets/braces in shell regular expression literals does not work
- Closed
-
SERVER-3994 Brace matching in mongo shell could be better
- Closed