The QBasic Forum      Other Subforums, Links and Downloads
 Return to Index  

Yes, CONST is very useful

March 24 2008 at 3:02 PM
qbguy  (no login)


Response to Some debugging techniques

CONST lets you give names to constants; instead of referring to pi as 3.14159265358979323846264338327950288419716939937510 at every appearance, the variable PI can be given that value with a CONST statement and used instead of the longer form of the constant. This also simplifies modifying the program, should the value of pi change.

Of course, the stupid way to use CONST is:

CONST ONE = 1
CONST TWO = 2
CONST THREE = 3

Or even worse:

CONST THOUSAND = 42


----
A computer without COBOL is like a piece of chocolate cake without ketchup.

 
 Respond to this message   
Responses

Newbies usually go to www.qbasic.com and click on The QBasic Forum
Forum regulars have their own ways, which include The QBasic Community Forums