One further thing to note is that even though var1 is available script-wide, if you change it inside a nested block of yaml (e.g. in the choose sequence) those changes will not be available outside that block.
EDITed as I realised my understanding of YAML variables was still not quite correct. I thought once defined they were immutable (effectively Constants).
From Tom’s comment re Scope, I now suspect that:
A Var can be “changed” (strictly re-defined?) at their creation scope level, but a Var of the same name defined at a deeper scope level is a new Var, and so effectively overrides the first Var’s value at that scope and deeper, but not at shallower scopes where the first Var definition will still apply. They are two separate items, both named Var.
So I think the full implications of “Variables have local scope” need making clearer. I’d mis-understood it, even knowing the local scope rule - I thought.