Skip to content

_exists

bergsma edited this page Sep 26, 2014 · 5 revisions

#exists

###Test for the existance of a variable.

Syntax

status = exists variable ;

Arguments

  1. list variable

A valid identifier.

Return Value

boolean status
  • 1 : The variable exists.

The STATUS variable is set to $ACKNOWLEDGE

  • 0 : The variable does not exist.

The STATUS variable is set to %UNDEFINED

Warnings

  • %UNDEFINED : The variable does not exist.

Exceptions

  • %ARGUMENT: Invalid arguments. Usage: status = exists variable ;

  • %IDENTIFIER: 'variable' argument is not a valid identifier, literal, or reference

Description

desc

Examples

global ;
int a = 100 ;
if ( exists ( a ) ) describe a ;

if ( !exists ( b ) ) puts "No variable named 'b'" ;

// Switch to local scope
local ;
{
   // define a local definiton of a
   int a = 99 ;
   put a ;
   // delete the local definition
   undef a ;
   put a ;
   if ( exists ( a ) ) puts "Global definition of 'a' still exists." ;
}

Related Links

undef

Clone this wiki locally