hi
i think no need to loop u can do it like this also
alias vget {
if (!$2) { echo -ea invalid parameters! | HALT }
var %x $iif($0 = 4,$1-3,$1-2)
if $(% $+ $replace(%x,$chr(32),$chr($(,$+($,$0)))),2) { return $v1 }
else { echo 7 -ae % $+ $replace(%x,$chr(32),$chr($(,$+($,$0)))) is not set! }
}
P.S: this is just an E.G not tested yet only to give some idea