How to define Global Variables within Scripts, i.e. "on the fly"?

TIme passed and the Forum system changed. New URL to Sergii’s post is here

I was surprised to find the post is dated at Jun, 2018 — also surprised that I made some comment to the same discussion but I forgot it at all. ---- in fact, I did not know Groovy metaprogramming then and could not understand Sergi’s code.

The pioneer of metaprogramming in Katalon Studio is here, Sergii.