Core Function IsDeclared

From Sputnik Wiki
(Difference between revisions)
Jump to: navigation, search
(Return Value)
Line 24: Line 24:
 
=== Return Value ===
 
=== Return Value ===
  
Success: Returns 1 if variable has been assigned.
+
Success: Returns true if variable has been assigned.
  
Failure: Returns 0 if variable doesn't exist yet.
+
Failure: Returns false if variable doesn't exist yet.
  
 
=== Remarks ===
 
=== Remarks ===

Revision as of 23:12, 25 August 2013

IsDeclared( <variable name>, <flag> )

Contents

Description

Check if a variable has been declared

Parameters

variable name

String representing name of the variable to be checked.

flag

Optional; Flag to decide the scope to be checked.

0 = ANY scope (Should be Local first then Global) (Default)
1 = Local scope only
2 = Global scope only

Return Value

Success: Returns true if variable has been assigned.

Failure: Returns false if variable doesn't exist yet.

Remarks

Example

If (!IsDeclared("a"))
    MsgBox('$a is NOT declared');     // $a has never been assigned
 
$a=1;
 
If (IsDeclared ("a"))
    MsgBox('$a IS declared');      //due to previous $a=1 assignment
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox