Sep-28-2018, 05:14 PM
(Sep-28-2018, 04:35 PM)WuchaDoin Wrote: How would you use a variable globally without being global?
With parameters and return values:
>>>> def add2(x): ... return x + 2 ... >>> z = 5 >>> z = add2(z) >>> z 7Also with classes, which can retain values within an instance of the class. There are links to tutorials for both in my signature below.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures