| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <html>
- <head>
- <meta http-equiv="Content-Type"
- content="text/html; charset=iso-8859-1">
- <title>Language Reference - Constants</title>
- <link rel="stylesheet" href="lang_ref.css" type="text/css">
- </head>
- <body><br>
- <span class="Command"> Constants </span>
- <blockquote>
- <p>Constants may be of any basic data type. Constants are variables that have
- fixed values that will not change (ever) during the course of your program.
- These are useful tools for things like screen resolution variables, etc.</p>
- <p><b>Floating point constants</b> must include a decimal point. </p>
- <p>For example: </p>
- </blockquote>
- <p align=left>
- <blockquote>
- <blockquote><i> '5' is an integer constant, but '5.0' is a floating point constant.
- </i> </blockquote>
- <p><b>String constants</b> must be surrounded by quotation marks, for example:</p>
- </blockquote>
- <p>
- <p align=left>
- <blockquote>
- <blockquote> <i>"This is a string constant". </i> </blockquote>
- <p>The '<b>Const</b>' keyword is used to assign an identifier to a constant.
- For example:</p>
- </blockquote>
- <p>
- <p align=left>
- <blockquote>
- <blockquote><i> Const one_hundred=100 </i> </blockquote>
- <p> You can then use the identifier 'one_hundred' anywhere in your program instead
- of '100'. </p>
- </blockquote>
- <p>
- <blockquote>
- <p>A more useful example might be:</p>
- </blockquote>
- <p align=left>
- <blockquote>
- <blockquote>
- <i>Const width=640,height=480 </i> </blockquote>
- <p> You can then use the more readable '<i>width</i>' and '<i>height</i>' throughout
- your program instead of '640' and '480'. </p>
- <p>Also, if you ever decide to change the width and height values, you only
- have to do so at one place in the program.<br>
- </p>
- <p> There are two built-in <b>Integer constants</b> - 'true' and 'false'. 'true'
- is equal to 1, and 'false' is equal to 0. </p>
- <p> There is also a built in <b>floating point constant</b> for Pi. </p>
- <p> </p>
- </blockquote>
- </body>
- </html>
|