Man, just read the chapter "Using Maya -> General -> MEL and Expressions -> Procedures" in the online manual. That should answer all your questions.
I don't want to be unfriendly, but it seems that as soon as a question pops into your mind, you post it. IMHO forums should be the last resort, if all of the following failed: thinking, reading the manual, thinking, searching the forums, thinking, and google. This isn't the case, otherwise you wouldn't be "not so good at expressing your thoughts".
you know what they say if you don't have anything nice to say.....
i've been through the online manuals and i'm just trying to get some indepth knowledge. It's my nature to be curious and when I can't find something, I ask. There is nothing wrong with that. If you don't want to answer then don't. Simple as that.
This forum is pretty much one big knowledge base. NOT a 'last resort'. It's here for those that need/want help. I went through the forum and I did not find anything related to my particular problem. I wanted help with it and I got it (thanks Joojaa & Campbell). After that I was curious as to how it did what it did.
If anything, I feel sorry for you since you obviously have a problem with asking for help.
And yea Queequeg, I was offended by your little remark, and it was unfriendly. Please refer to my first comment in this post.
Not allways, sometimes pople need to be pointed out they are being stupid. Usualy not tough.
Well, all this is pretty well explained in the manuals true enough. Its just that reading the manuals (or any manual for that matter) requires you to be a bit tuned in to whats going on. I mean sometimes people arent up to the fact that they are reading, or they lack the bits of info on the base levell asumed to be understood (it is impossible to write a manual that would be on 0 levell). So you might want go back to them later just to se if your knowledge makes you understand things better.
This all boils down to a programming concept called scope. Scope describes how and where varibles are born whan they are discareded etc. In maya there are a 2 levels of scope Global and local. Global is defined everywhere unless someone defines a local variable at that levell.
Also a pieculiar fact is that if there are inner codeblocks any higher level definition traverses downward. Unless the curent codeblock has ended before that. Scope is defined by