About Constants

Prev Next Home Home Table Of Contents Index

ABOUT CONSTANTS

Constants are used to give values meaningful names. By using constants a value can be assigned once and the constant name used throughout the menu program. This way, if you change the value of the constant, all the places where that constant is used automatically change.

This is good programming practice.


 Examples:

Const States = 50 CPU = '80386 SX' WeekEnd = True

or

Const States = 50 CPU = '80386 SX' WeekEnd = True

Using the word STATES is just like using 50. Using CPU is just like using '80386 SX'. But if throughout my menu you use CPU, and then you get a new computer with a 80486, you can just change one line:


 Const CPU = '80486'

And all the places you used CPU changes to '80486'. This is the correct way to program.

Prev Next Home Home Table Of Contents Index

Sponsors
Shopping
Forum
Forum
email
EMail
Index
Index
Home
Home