Console troubles

Started by Zlatko Vid, June 15, 2025, 07:54:09 PM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

Zlatko Vid

Hi to all..
I must say that i hate console but
i am kind a forced to use it for QB translation to o2 code
so why goto ExitDo or just Exit Do not jump from DO/END DO loop ?
or what i am doing wrong  :o

DO
ans = INPUT
if lcase(ans) = "y" : goto ExitDo : end if
print ans
END DO

ExitDo:
waitkey
CLS

 

Zlatko Vid

does really need to be trimmed?

ans = ltrim rtrim(input())

?

Charles Pegge

Hi Aurel.

O2's input is unprocessed, so it captures the crlf. rtrim removes all trailing white-space.

uses console
string ans
DO
ans = rtrim INPUT
if lcase(ans) = "y" : goto ExitDo : end if
print ans
END DO

ExitDo:
waitkey
CLS

Zlatko Vid

Hi Charles

Aha i see then ok  ;)