[Gambas-user] Why this simple program doesn't work
Alonzo Flinston
francesco.difusco at ...69...
Sat Sep 17 16:27:26 CEST 2005
> >
> There are a number of reasons why it doesn't work.
> One is that
>
> (cifra <> "0" OR cifra <> "1")
>
> will always return true no matter which character cifra contains.
Ok, I have understood my mistake. Now I have changed the source, and it
works
DO WHILE (i <= n AND numbin = TRUE)
cifra = Mid$(binario, i, 1)
IF (cifra = "0" OR cifra = "1") THEN
i = i + 1
ELSE
numbin = FALSE
ENDIF
LOOP
> For i =1 to n
> cifra = Mid$(binario, i, 1)
> IF NOT (cifra = "0" OR cifra = "1") THEN
> numbin = FALSE
> BREAK
> END IF
> NEXT
> RETURN numbin
> END
> -----------------------------
>
I didn't want to execute a FOR loop, for I don't want to force exiting
from the loop, using a BREAK instruction.
Thank you very muche for having let me notice my logical mistake.
Francesco
> -------------------------------------------------------
> SF.Net email is sponsored by:
> Tame your development challenges with Apache's Geronimo App Server.
> Download it for free - -and be entered to win a 42" plasma tv or your very
> own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
--
Teaching OnLine
Corsi online di programmazione
Php, Asp, C, C++, Visual Basic, Delphi
Linux Shell Programming
------------------------------------
http://www.teachingonline.it
More information about the User
mailing list