lang_ref_constants.html 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type"
  4. content="text/html; charset=iso-8859-1">
  5. <title>Language Reference - Constants</title>
  6. <link rel="stylesheet" href="lang_ref.css" type="text/css">
  7. </head>
  8. <body><br>
  9. &nbsp;<span class="Command">&nbsp;Constants&nbsp;</span>
  10. <blockquote>
  11. <p>Constants may be of any basic data type. Constants are variables that have
  12. fixed values that will not change (ever) during the course of your program.
  13. These are useful tools for things like screen resolution variables, etc.</p>
  14. <p><b>Floating point constants</b> must include a decimal point. </p>
  15. <p>For example: </p>
  16. </blockquote>
  17. <p align=left>
  18. <blockquote>
  19. <blockquote><i> '5' is an integer constant, but '5.0' is a floating point constant.
  20. </i> </blockquote>
  21. <p><b>String constants</b> must be surrounded by quotation marks, for example:</p>
  22. </blockquote>
  23. <p>
  24. <p align=left>
  25. <blockquote>
  26. <blockquote> <i>"This is a string constant". </i> </blockquote>
  27. <p>The '<b>Const</b>' keyword is used to assign an identifier to a constant.
  28. For example:</p>
  29. </blockquote>
  30. <p>
  31. <p align=left>
  32. <blockquote>
  33. <blockquote><i> Const one_hundred=100 </i> </blockquote>
  34. <p> You can then use the identifier 'one_hundred' anywhere in your program instead
  35. of '100'. </p>
  36. </blockquote>
  37. <p>
  38. <blockquote>
  39. <p>A more useful example might be:</p>
  40. </blockquote>
  41. <p align=left>
  42. <blockquote>
  43. <blockquote>
  44. <i>Const width=640,height=480 </i> </blockquote>
  45. <p> You can then use the more readable '<i>width</i>' and '<i>height</i>' throughout
  46. your program instead of '640' and '480'. </p>
  47. <p>Also, if you ever decide to change the width and height values, you only
  48. have to do so at one place in the program.<br>
  49. </p>
  50. <p> There are two built-in <b>Integer constants</b> - 'true' and 'false'. 'true'
  51. is equal to 1, and 'false' is equal to 0. </p>
  52. <p> There is also a built in <b>floating point constant</b> for Pi. </p>
  53. <p>&nbsp; </p>
  54. </blockquote>
  55. </body>
  56. </html>