R
Rich Pasco
Scripts for the command-shell interpreter cmd.exe use parentheses in
two ways: One is for blocks, as in
if condition (
do this
and this
)
The other is for grouping in arithmetic expressions, like this:
set /a result = 2*(3+4)
which assigns the value 14 to the environment variable "result."
However, using such an assignment inside a block leads to confusion, e.g.
if 1==1 (
set /a result = 2*(3+4)
)
which leads to an "Unbalanced parenthesis" error as the closing
parenthesis on the arithmetic expression is mistaken as the closing
parenthesis on the conditional block.
- Rich
two ways: One is for blocks, as in
if condition (
do this
and this
)
The other is for grouping in arithmetic expressions, like this:
set /a result = 2*(3+4)
which assigns the value 14 to the environment variable "result."
However, using such an assignment inside a block leads to confusion, e.g.
if 1==1 (
set /a result = 2*(3+4)
)
which leads to an "Unbalanced parenthesis" error as the closing
parenthesis on the arithmetic expression is mistaken as the closing
parenthesis on the conditional block.
- Rich