06-07-2023, 08:41 PM
(06-07-2023, 06:13 PM)Kernelpanic Wrote:Quote:@Terry - Correct. If OPTION _EXPLICIT were the first line of code in the example, the variable mm would have been flagged immediately. Also, a constant is not an ordinary variable. A constant can't have its value changed once set. The IDE will flag this if you try it:Ordinary variable is probably worded a bit imprecisely, but by now one should know what I mean: Without Option Explicit there is no guarantee that a constant variable will be changed by a typo. This can really be a very nasty bug in a larger program - until you find it.
Ah, OK, I read your statement wrong. You are advocating for the use of OPTION _EXPLICIT to avoid this from happening, gotcha.
Something I used to do before OPTION _EXPLICIT existed in QB64 was to always capitalize every letter in constants except for the first letter which was always a lower case c. This way if I mistyped a constant the IDE would not capitalize it letting me know I misspelled it.
CONST cONEDEGREE = .017453292
<code>
<code>
Xrotate = Xrotate + condegree ' won't capitalize because of misspelling