Page 1 of 1

Explicitly declare variables local to a flow or block.

Posted: 25 Nov 2019 05:39
by jassing
Would be nice to declare variables as local to a flow, such that calling another flow won't wind up updating the parent's variable

Also, local to a block

{
local a;
a=5;
}

Just similar to standard C...

Re: Explicitly declare variables local to a flow or block.

Posted: 25 Nov 2019 17:54
by Desmanto
Martin ever thought about limiting and selecting which variable to be passed on the child's flow or returned back to parent's flow. Maybe that is better solution. But I don't know how is the progress.

For local block variable, seems unnecessary. I just reuse all the i, j, k from all the loop I used. The value get replace at every new block, so basically the same as having them the same as local block variable. But if you really need to clean up the variable (maybe your script depends on the null value of the variables), you can use removeVariable("a") or any variable name in quotes, before proceeding to the next block.