- Aide Scilab
- Scilab
- Mots clés Scilab
- TMPDIR
- abort
- argn
- banner
- boolean
- break
- clear
- clearglobal
- comp
- debug
- errcatch
- errclear
- error
- exists
- exit
- external
- extraction
- getos
- getshell
- gstacksize
- ieee
- insertion
- inv_coeff
- iserror
- isglobal
- macr2tree
- matrices
- matrix
- mode
- mtlb_mode
- names
- null
- pause
- perl
- poly
- predef
- quit
- rational
- resume
- sciargs
- scilab
- stacksize
- startup
- symbols
- testmatrix
- type
- typename
- user
- varn
- what
- where
- whereami
- who
- whos
- with_atlas
- with_javasci
- with_macros_source
- with_pvm
- add_demo
- clearfun
- continue
- delbpt
- dispbpt
- edit
- error_table
- format
- funcprot
- funptr
- getdebuginfo
- getmd5
- getmemory
- getmodules
- getscilabmode
- getvariablesonstack
- getversion
- intppty
- lasterror
- macr2lst
- newfun
- readgateway
- setbpt
- ver
- warning
- who_user
- with_module
- with_texmacs
- with_tk
exists
teste l'existence d'une variable
Séquence d'appel
exists(name [,where])
Paramètres
- name
chaîne de caractères
- where
une chaîne de caractères optionnelle pouvant prendre les valeurs:
'l'(local),'n'(nolocal) et'a'(all). La valeur par défaut est'all'
Description
exists(name) renvoie 1 si la variable nommée
name existe et 0 sinon.
Mise en garde : une fonction utilisant exists peut
renvoyer un résultat dépendant de l'environnement courant !
exists(name,'local') renvoie 1 si la variable
nommée name existe dans l'environnement de la fonction
courante et 0 sinon.
exists(name,'nolocal') renvoie 1 si la
variable nommée name existe dans l'environnement appelant (y
compris le niveau du shell Scilab) de la fonction courante et 0
sinon.
Attention: la fonction exists ne teste
pas si une variable existe dans l'espace de nom global.
Exemples
deff('foo(x)',.. ['disp([exists(''a12''),exists(''a12'',''local'')])' 'disp([exists(''x''),exists(''x'',''local'')])']) foo(1) a12=[];foo(1) function level1() function level2() disp(exists("a","all")); disp(exists("a","local")); disp(exists("a","nolocal")); endfunction level2() endfunction function go() a=1; level1() endfunction go()
Voir aussi
| << error | Scilab | exit >> |