User Tools

Site Tools


pt:ifthen

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

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

Introdução

0.9.4g

pt/ifthen.txt · Last modified: 2020/02/28 10:46 (external edit)