[Tutor] Fw: path string

Alan Gauld alan.gauld at yahoo.co.uk
Wed Jan 4 04:27:30 EST 2017


On 03/01/17 15:59, anatta anatta wrote:

> Please disregard my request below.
> 
> I know the problem!
> 
> I have not defined the variable in question as a global variable.

That's one solution but its not a very good one.

Global variables are not considered good practice for many
reasons. In particular, they make code reuse difficult and
if you ever need to use your code in a multi-threaded
environment, to improve performance say, they are nearly
impossible to work with.

It's much better to pass the required value out of the function
as a return value.

> regret the inconvenience caused.

No inconvenience, its what the list is here for! :-)

hth
-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list