Interestingly, this only happens using a legacy script.
Putting "vim9script" above it avoids the problem.
This must be because in Vim9 script variables are kept local to a block.
In legacy script a variable declared in a block can be used after that
block. On the other hand, the {} block is Vim9 script, thus it's like
the variable is not really defined at the script level.
I think this needs to be fixed, the example should work.
--
You got to work at a mill? Lucky! I got sent back to work in the
acid-mines for my daily crust of stale bread... which not even the
birds would eat.
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///