Programming: Variable naming conventions

From virtualMV2015wiki
Jump to: navigation, search
 Home  Main Page <

Table of commonly used prefixes

In order to make reading a program's code easier, many programmers prefix variables to help identify their type The following table lists some commonly used prefixes. They are pretty standard for VisualBasic but can be used effectively in other languages.

PrefixDescriptionExample
Variables
datDatedatDay
dtmDate and/or TimedtmEnd
intIntegerintX, intDay
strStringstrWeekName
vntVariant (an untyped number e.g. JavaScript)vntTotal
Numeric (approx values shown)
bytByte (1 byte:0-255)intX, intDay
intInteger (2 byte:+/- 32,768)intI, intDay
lngLong (4 bytes:+/- 2,147,483,648)lngBillsSalary
sngSingle (4 bytes:Negative values: -3.402823E+38 to -1.401298E-45; Positive values: 1.401298E-45 to 3.402823E+38)lngBillsSalary
sngDouble (8 bytes:Negative values: -1.79769313486232e+308 to -4.94065645841247E-324; Positive values: 4.94065645841247E-324 to 1.79769313486232e+308)lngBillsSalary
curCurrency (8 bytes:+/-922,337,203,685,477.5808)lngBillsSalary
Form controls
cboCombo boxcboWeekDays
lstList boxlstFullName
txtText boxtxtFirstName

Notes

  • For an array use the array type e.g. strDays[1], intDayNum[1] or arrX

References: Oracle Thinkquest(n.d.)[1], University of Illinois (2008)[2], VB6.us (n.d.)[3]

Microsoft (2009)[4]


Icon References.png References

  1. Oracle Thinkquest(n.d.) Intro to Variables. Retrieved January 15, 2009 from http://library.thinkquest.org/26272/introto.htm
  2. University of Illinois (2008). Constant and Variable Naming Conventions. Retrieved January 15, 2009 from https://agora.cs.illinois.edu/display/cs105sp08/Constant+and+Variable+Naming+Conventions
  3. VB6.us (n.d.) Object Types and Naming Scheme (VB6). Retrieved January 15, 2009 from http://www.vb6.us/tutorials/object-types-and-naming-scheme
  4. Microsoft (2009). INFO: Microsoft Consulting Services Naming Conventions for Visual Basic. Retrieved April 3, 2009 from http://support.microsoft.com/kb/110264

Programming: Variable naming conventions. (2017). In virtualMV's ( Michael Verhaart ) wiki. Retrieved March 29, 2017, from http://www.virtualmv.com/wiki/index.php?title=Programming%3A_Variable_naming_conventions    (zotero)