Interactive PowerBasic Forum

IT-Consultant: Charles Pegge => OxygenBasic Examples => Topic started by: Zlatko Vid on June 15, 2025, 07:54:09 PM

Title: Console troubles
Post by: Zlatko Vid on June 15, 2025, 07:54:09 PM
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

 
Title: Re: Console troubles
Post by: Zlatko Vid on June 15, 2025, 08:01:02 PM
does really need to be trimmed?

ans = ltrim rtrim(input())

?
Title: Re: Console troubles
Post by: Charles Pegge on June 16, 2025, 12:35:33 PM
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
Title: Re: Console troubles
Post by: Zlatko Vid on June 19, 2025, 08:13:50 AM
Hi Charles

Aha i see then ok  ;)