Hi, programmers!
there's global and local variables ? I've heard about common variables....what is it ?
Does anybody know? if so - please - share your knowledge!
Thanks in advance !

Hi there vedro-compota,

Variables exist within the scope of their creation.
Make a variable within a class, and that's its scope.
Make a variable within a method, and that's its scope.
So make it within the program, but outside of any one class.
If you make it in the program.cs file, and make it public then any class within the program can access it as... (source)

Edited 5 Years Ago by Mitja Bonca: n/a

Comments
++++++++

Vedro - lets put it this way: You are on the beginning of your programming path, if Iam not mistaking. So, if you know what is local and global variable, will do good for the next a couple of years. Belive me. I`m coding for a 2,5 years and havent encountered any need or something of using common varibale.
Truly, I dont even need a common varible (even if I dont actually know what this is, or if it exists).
So, if you know local and global variables, and you know how to operate and use them, is more then enough.

back to the books vedro :)
btw, I have a good one for you if you want to learn: C# TheComplete Reference

Edited 5 Years Ago by Mitja Bonca: n/a

Mitja Bonca - thanks you very much )) I hope there's something about common variables inthis book)) although it is more about general programming theory)))

This article has been dead for over six months. Start a new discussion instead.