Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.3.1 - Português

Change language to:
English - Français - 日本語 -

Please note that the recommended version of Scilab is 2024.0.0. This page might be outdated.
See the recommended documentation of this function

Ajuda Scilab >> Scilab > exists

exists

verifica existência de variáveis

Seqüência de Chamamento

exists(name [,where])

Parâmetros

name

string

where

um caractere opcional com possíveis valores: 'l' (local), 'n' (nolocal) and 'a' (all). O valor padrão é 'all'.

Descrição

exists(name) retorna 1 se a variável chamada name existe e 0, em caso contrário.

Aviso: uma função que utiliza exists pode retornar um resultado que depende do ambiente!

exists(name,'local') retorna 1 se a variável chamada name existe no ambiente local da função corrente e 0 , em caso contrário.

exists(name,'nolocal') retorna 1 se a variável chamada name existe em qualquer nível do ambiente de chamamento (incluindo o nível principal do shell do Scilab) da função corrente e 0 , em caso contrário.

Aviso: a função exists não verifica se a variável existe no espaço de nomes global.

Exemplos

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()
<< error_table Scilab exit >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Mar 03 11:00:26 CET 2011