Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Option _Explicit Keyword(s) of day XXX:
#17
(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.

Once a CONST is set, it remains constant -- it can't be changed.  There's nothing to stop you from making a typo and misspelling the CONST (cheetos instead of cheetoes), but the CONST, as defined, won't change once it's set.
Reply


Messages In This Thread
RE: Option _Explicit Keyword(s) of day XXX: - by SMcNeill - 06-07-2023, 07:28 PM



Users browsing this thread: 2 Guest(s)