Adrien Thurin wrote:
This is a lot clearer. Thank you very much!
I particularly like the g4 function, because it is more readable, especially with more than one condition (or more complex conditions).
Yes, I sure wouldn't recommend g1 and g2.
And with all those functions you are free to add k and y as function arguments so they don't rely on global variables with a specific name but are self-contained ;-)