Variable set when verbose=yes

Hello, my friends.

I want to ask about strange behavour on script import.
Scripting manual tells that this code is correct:

:local test;
:set test "test";
:put $test;

I create test.rsc with this code and if i do

/import test.rsc

i got “test”. If I do

/import test.rsc verbose=yes

i got syntax error on second line on variable name.

Please, explain where is my mistake? Thanks.

If I set variable with $ in the beginning

:set $test "test";

it works fine with or without verbose.
It seems strange to me that I can’t find any discussion about it. This feature is obvious to all?

Each line in command line is executed as one scope, so if you define local variable in one scope it is not visible in another.
When you set verbose=yes, each line is processed as separate console line.

So either you define global variable instead of local or put the script in {} which will render verbose thing useless, because everything in {} will be executed as a single scope.