01-13-2005, 02:28 AM
Would it be better to write variables all in UPPERCASE or all in lowercase, which one would be easier to read, which stands out more etc.
Variables Upper or Lowercase
|
01-13-2005, 02:28 AM
Would it be better to write variables all in UPPERCASE or all in lowercase, which one would be easier to read, which stands out more etc.
01-13-2005, 02:36 AM
I usually write variables like this:
x% y% Something.x% MaxNumberOfNodes& AngleOffX! Array%(1 to 5) I find that writing them in all upper-case makes them look too much like the QB commands themselves. But it's all personal preference, once compiled. *peace* Meg.
01-13-2005, 04:36 AM
Here's the normal format I follow:
first of all, all variables are defined before used, and I always know what type they are (good memory I guess, hehe). Variables start in lowercase but then if they're composed of several words, each word past the first has its first word capitalized, like: myVariableIsBigAndStuff I do constants and types in uppercase: Const BIG_DOG_DISH = 1 Type DOGFOOD_BRANDS and again, using memory to remember which is which. Functions and Subs are like Variables except every word has its first letter capitalized: Sub ThisIsMyDogFoodSub (whichOne As DOGFOOD_BRANDS) but as Meg says, it's all personal choice. This is just the style I personally use.
I'd knock on wood, but my desk is particle board.
01-13-2005, 05:51 AM
I lowercase all my variables just to make them stick out as compared to commands, but yeah, it's all up to you, just be consistant to your own style.
his sig left intentionally blank
01-13-2005, 02:02 PM
Usually, CAPS are used for constants, and lower-case/upper-case mixed for identifiers. Some prefer using "_" to separate words inside the identifier, some other prefer using Caps as in Nek's examples.
In OOP languages, classes should begin with upper-case, variables with lower-case, so you know what's what: NUM will be a constant, Employee will be a class and dummyValue will be a variable.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio underBASIC, homegrown musicians [img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
01-13-2005, 11:33 PM
also you can prefix the first character of the datatype to the variable name to make it easily identifiable. Something like:
Code: DIM nVar AS INTEGER So a person reading your program will easily understand that "nVar" is an integer/number while "cVar" is a character variable. |
« Next Oldest | Next Newest »
|