|
Explicit | |||
Explicit State | |||
Parameters: State = The State variable declaration ON= Explicit declaration, OFF = Implicit (default) |
|||
Returns: NONE | |||
Explicit lets the user change what variable declaration mode that the compiler uses. When enabled (Explicit ON) PlayBASIC will force the user to declare every variable prior to the variable being used. The beauty of activating Explicit mode, is that it can help you locate faults in your program that might occur due to a misspelled variable name. Such problems are common and can be very frustrating to track down. Moreover you can enable/disable Explicit mode anywhere you like through out your program. (see example) State Values ON = Explicit declaration: Variables must be declared prior to use. OFF = Implicit declaration: Variables will be dynamically declared for you. This is the default variable creation mode for PlayBASIC. FACTS: * Explicit can be turned ON/OFF at any time through a program. Allowing you activate it for some sections and not others. * Explicit parameter is optional. Explicit defaults to ON when the parameter is left off. * The current value of explicit mode is held in the pbExplicitState constant. Mini Tutorial #1: This example demos the basics of PlayBASIC Explicit mode.
This example would output.
Mini Tutorial #2: Sometimes in our programs we might want to use explicit mode in some parts and not others, so it can be very handy to ask PlayBASIC what the current state of explicit mode is at the start of block of code, then restore it later on. So if you included in the code in another programs or shared the code with other programmers, then it wouldn't change the state.
|
Related Info: | Byte | Dim | Float | ForceDeclaration | Global | Integer | Local | OptExpressions | Pointer | Static | String | Type | Word : |
|
|||||||||||||||||||||||||||||||||||||||
(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com |