User Tools

Site Tools


pt:ifthen

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

pt:ifthen [2016/01/01 22:48]
pt:ifthen [2020/02/28 10:46] (current)
Line 1: Line 1:
 +===== If / Then =====
 +==== Formato ====
 +**if** //booleanexpr// **then** //statement//
 +----
 +**if** //booleanexpr// **then**\\
 +//statement(s)//\\
 +**end if**
 +----
 +**if** //booleanexpr// **then**\\
 +//statement(s)//\\
 +**else**\\
 +//statement(s)//\\
 +**end if**
 +
 +==== Descrição ====
 +Trata-se de uma instrução com várias formas. IF avalia //booleanexpr//, que se for verdadeira executa //statement(s)// após THEN. Para executar vérias linhas de código ter-se-á que pôr ENDIF no fim. Para executar código quando  //booleanexpr// é falsa então é usado ELSE.
 +==== Exemplo ====
 +<code>
 +print "Guess my letter - press a key"
 +# wait for the user to press a key
 +do
 +  a = key
 +  pause .01
 +until a <> 0
 +#
 +if chr(a) = "Z" then
 +   print "Yippie, you pressed the Z key!!!"
 +else
 +   print "darn, you pressed something else."
 +end if
 +#
 +end
 +</code>
 +
 +==== Introdução ==== 
 +0.9.4g
  
pt/ifthen.txt · Last modified: 2020/02/28 10:46 (external edit)