in reply to Conditional initialization of my-variables
G'day muthm,
Take a look at ++hv's post from last week which discusses this issue. In particular, his "it acts something like a state variable" aligns with your "keeps its value from the previous call".
The solution he presents is the same as the response you've already received from ++LanX; namely, separate the declaration from the conditional assignment.
— Ken
|
---|