Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site amdahl.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!godot!harvard!seismo!hao!hplabs!nsc!amdahl!dwl10 From: dwl10@amdahl.UUCP (dwl10) Newsgroups: net.micro.cbm Subject: Re: VIC20 BASIC bug (?) Message-ID: <684@amdahl.UUCP> Date: Thu, 6-Dec-84 09:47:12 EST Article-I.D.: amdahl.684 Posted: Thu Dec 6 09:47:12 1984 Date-Received: Sun, 9-Dec-84 03:11:45 EST References: <596@burl.UUCP> Organization: Amdahl Corp, Sunnyvale CA Lines: 55 > -- > My nephew has a VIC20, and I am (shudder) trying to teach him some > fundamentals of programming in BASIC. There is a problem: his > machine isn't acting right. Now I'll admit to not being terribly > familiar with the language (I play with my C64 in assembler), but > what would you expect the following code to do? > > 110 PRINT"THIS IS A PRINT STATEMENT" > 120 PRINT"THIS IS ANOTHER PRINT STATEMENT" > 130 PRINT"THIS IS YET ANOTHER PRINT STATEMENT" > 140 PRINT > 150 INPUT"WHAT DO YOU SAY TO THAT";I$ > 160 IF I$ = "" THEN 150 > 170 PRINT I$ > > My C64 executes this the way I'd expect; if the return is pressed > after "WHAT DO YOU SAY TO THAT?" without entering at least one > character, line 150 is executed again, prompting the user with > another "WHAT DO YOU SAY TO THAT?" and so on until the user finally > enters something. > > But on my nephew's VIC20, if the return is pressed without typing > anything else, the machine produces the following session: > > THIS IS A PRINT STATEMENT > THIS IS ANOTHER PRINT STATEMENT > THIS IS YET ANOTHER PRINT STATEMENT > > WHAT DO YOU SAY TO THAT? > > WHAT DO YOU SAY TO THAT? > READY > This is a known Commodore Basic bug. If the prompt from an INPUT statement wraps on the screen, then that prompt will be included in the input. In your example, since you typed nothing, then the input variable, I$, contained only the input prompt. If you had entered ABC as your reply, then I$ would be equal to : WHAT DO YOU SAT TO THAT? ABC The solution is: 1 - Limit your prompts to less than 22 characters or 2 - PRINT your prompt and then do the INPUT without any prompt. -- ----------------------------------------------------------------------- Dave Lowrey "GORT...Klatu borada niktow" ...{amd,hplabs,ihnp4,nsc}!amdahl!dwl10 [ The opinions expressedbe those of the author and not necessarily those of his most eminent employer. ]