Fórum Problema de lógica (desvio condicional) #215901
21/02/2004
0
Um exemplo: Eu mando um valor ´VARALPHA´ para a varável senão, eu envio ´VAROMEGA´, mas ele não lê o ´VAROMEGA´...
E nenhum valor seguinte...
[b:a94e717035][color=red:a94e717035]Título editado pelo Moderador (AZ) - Removido: ´Um probleminha...´[/color:a94e717035][/b:a94e717035]
Jasig Aurumalfa
Curtir tópico
+ 0Posts
21/02/2004
Fórum Vini
Vinicius.
Gostei + 0
21/02/2004
Jasig Aurumalfa
If VARSTRING=´VARALPHA´ then
begin
VARALPHAFORM.Show //Esse ele lê
end
else
begin
If VARSTRING=´VAROMEGA´ then
begin
VAROMEGAFORM.Show //Esse ele não lê
end;
end;
Gostei + 0
21/02/2004
Marco Salles
Nunca é ´VAROMEGA´ , Ou O Form VAROMEGAForm Não Foi Criado, Mas Isto Deveria Dar Um Erro Na Execução :?: No Mais Olhe Só Com Poderemso Escrever o Seu Código Com Menos Begin-end
If VARSTRING=´VARALPHA´ then VARALPHAFORM.Show //Esse ele lê else If VARSTRING=´VAROMEGA´ then VAROMEGAFORM.Show //Esse ele não lê
Gostei + 0
21/02/2004
Jasig Aurumalfa
Gostei + 0
21/02/2004
Marco Salles
o ´VAROMEGA´ :?: :?: :?:
Voce Escreveu o Código Abaixo:
If VARSTRING=´VARALPHA´ then begin VARALPHAFORM.Show //Esse ele lê end else begin If VARSTRING=´VAROMEGA´ then begin VAROMEGAFORM.Show //Esse ele não lê end; end;
Tecnicamente Esta Faltando Dois Pontos e Virgula No Seu Código:
If VARSTRING=´VARALPHA´ then begin VARALPHAFORM.Show; //Esse ele lê [color=darkred]*****Ponto e Vírgula[/color] end else begin If VARSTRING=´VAROMEGA´ then begin VAROMEGAFORM.Show; //Esse ele não lê [color=red]*****Ponto e Virgula[/color] end; end;
Diga-se De Passagem Que Foi Assinala-do Para Voce, Em Outro Tópico Que Antes Do Else Não Se Usa Ponto-Virgula, Mas é na Istrução Imediatamente ANTERIOR E Não Em Toda Instrução Anterior...Mas Voce,
Consegui Ou Não Ler 0 o ´VAROMEGA´ :?: :?: :?:
Gostei + 0
21/02/2004
Marcelo
If UpperCase( VARSTRING ) = ´VARALPHA´ then
VARALPHAFORM.Show
else
VAROMEGAFORM.Show;
Certamente assim você terá algum resultado!
Valeu?
Gostei + 0
21/02/2004
Aroldo Zanela
Não há nenhum problema no seu código. Fiz uma simplificação mantendo ´begins e ends´ e a estrutura lógica para quem quiser testar, pois funciona para ambos os valores:
var varString: String; begin varString := ´VAROMEGA´; If VARSTRING=´VARALPHA´ then begin ShowMessage(´VarAlphaForm´) end else begin // Tudo que for diferente de VARALPHA If VARSTRING=´VAROMEGA´ then begin ShowMessage(´VarOmegaForm´) end; end; end;
Gostei + 0
21/02/2004
Tnaires
De fato, eu deveria ter sido mais claro. Grande marco.
Gostei + 0
21/02/2004
Jasig Aurumalfa
Dúvida no desenvolvimento do comando ele...
Seria mais claro...
Gostei + 0
22/02/2004
Beppe
Dúvida no desenvolvimento do comando ele...
Seria mais claro...[/quote:4569ca8091]
Ue, o el[b:4569ca8091]s[/b:4569ca8091]e ja esta desenvolvido...
Gostei + 0
22/02/2004
Facundo
Begin If (a = 1) Then Begin ShowMessage(´a = 1´); edCodigo.SetFocus; Exit //Vejam que aqui não precisa ´;´ End; ShowMessage(´Fim sequencia´) //Aqui também não precisa ´;´ end;
Gostei + 0
22/02/2004
Beppe
Exato, porque em Pascal(Delphi), o ; é separador, e não terminador de comandos.
Gostei + 0
22/02/2004
Marco Salles
´Tecnicamente´:
Gostei + 0