<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) 2008 - INRIA
 *
 * Copyright (C) 2012 - 2016 - Scilab Enterprises
 *
 * This file is hereby licensed under the terms of the GNU GPL v2.0,
 * pursuant to article 5.3.4 of the CeCILL v.2.1.
 * This file was originally licensed under the terms of the CeCILL v2.1,
 * and continues to be available under such terms.
 * For more information, see the COPYING file which you should have received
 * along with this program.
 *
 -->
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
          xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="http://www.w3.org/1999/xhtml"
          xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook"
          xmlns:scilab="http://www.scilab.org" xml:id="clear" xml:lang="pt">
    <refnamediv>
        <refname>clear</refname>
        <refpurpose>cancela variáveis</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Seqüência de Chamamento</title>
        <synopsis>
            clear a b c
            clear('a', 'b', 'c')
            clear(['a' 'b' 'c'])
        </synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>Parâmetros</title>
        <variablelist>
            <varlistentry>
                <term>a, b, c...</term>
                <listitem>
                    <para>variables of any type and size, but not protected</para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Descrição</title>
        <para>Este comando cancela variáveis que não estão protegidas. Ele remove
            as variáveis nomeadas do ambiente. Por si só, <literal>clear</literal>
            cancela todas as variáveis, exceto as protegidas por
            <literal>predef</literal>. Logo, os dois comandos
            <literal>predef(0)</literal> e <literal>clear</literal> removem todas as
            variáveis.
        </para>
        <para>Normalmente, variáveis protegidas são bibliotecas padrões e
            variáveis com o prefixo '%'
        </para>
        <para>
            Note a sintaxe particular <literal>clear a</literal> e não
            <literal>clear(a)</literal>. Note também que <literal>a=[]</literal> não
            cancela <literal>a</literal> , mas define <literal>a</literal> como uma
            matriz vazia.
        </para>
        <para>
            If a name <emphasis>Var</emphasis> matches no variable, <literal>clear Var</literal>
            does nothing silently.
        </para>
      <note>
        <literal>clear()</literal> can be overloaded for any <literal>mlist("foo")</literal> type,
        by defining a <literal>%foo_clear()</literal> macro. It will be called either when
        <literal>clear</literal> is explicitly applied to any mlist of this type, or implicitly
        when any mlist of this type is deleted when leaving the environment where it has been
        defined.
      </note>
    </refsection>
    <refsection>
        <title>Exemplos</title>
        <programlisting role="example"><![CDATA[
a = 2;
b = 3;
c = 4;
clear a
isdef("a") // F
isdef("b") // T
clear("b");
isdef("b") // F

a = 2;
b = 3;
c = 4;
clear(['a' 'b' 'c'])
isdef("a") | isdef("b") | isdef("c") // F
     ]]></programlisting>
        <programlisting role="example"><![CDATA[
function %foo_clear(o)
    disp("deleted");
endfunction

value = mlist("foo");
clear value // will print "deleted"
]]></programlisting>
    </refsection>
    <refsection>
        <title> Ver Também </title>
        <simplelist type="inline">
            <member>
                <link linkend="predef">predef</link>
            </member>
            <member>
                <link linkend="clearglobal">clearglobal</link>
            </member>
            <member>
                <link linkend="funcprot">funcprot</link>
            </member>
            <member>
                <link linkend="who">who</link>
            </member>
            <member>
                <link linkend="xmlDelete">xmlDelete</link>
            </member>
        </simplelist>
    </refsection>
    <refsection role="history">
        <title>Histórico</title>
        <revhistory>
            <revision>
                <revnumber>5.5.0</revnumber>
                <revdescription>Argument can now be a matrix of strings</revdescription>
            </revision>
            <revision>
                <revnumber>6.0.0</revnumber>
                <revdescription>
                  <literal>clear</literal> is now protected:
                  Assignments like <literal>clear=1</literal> are no longer possible.
                </revdescription>
            </revision>
            <revision>
                <revnumber>6.1.0</revnumber>
                <revdescription>
                    <literal>clear</literal> becomes overloadable for any
                    <literal>mlist("foo")</literal>, with <literal>%foo_clear()</literal>.
                </revdescription>
            </revision>
        </revhistory>
    </refsection>
</refentry>
