Option _Explicit Keyword(s) of day XXX:
#7
(06-07-2023, 02:09 PM)Kernelpanic Wrote:
(06-04-2023, 04:38 PM)TerryRitchie Wrote: I added OPTION _EXPLICIT yesterday to Lesson2: Introducing Variables in the tutorial:

https://www.qb64tutorial.com/lesson2

I used Steve's Cheetos example too Smile
@Terry (and @bplus) a constant is just an ordinary variable that can be accidentally changed without the Option Explicit.

From your tutorial:
[Image: Terry-Const-ohne-Option-P-07-2023.jpg]
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:

CONST Foo = 10
Foo = 3

"Expected variable = on line 2"

The IDE does not recognize Foo as a variable because it's been declared as a constant.
Software and cathedrals are much the same — first we build them, then we pray.
QB64 Tutorial
Reply


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



Users browsing this thread: 22 Guest(s)