Frozone212 Posted December 1, 2022 Share Posted December 1, 2022 It's real short and too easy but Fun to program for. Commodore basic does not support the ELSE statement. Therefore, I am somewhat screwed with decision making so the majority of commands done through INPUT. Bad practice but AFAIK, there is no extension that adds the command, I could be wrong here. I hope to expand this down the road. Enjoy Pirate Ship.d64 1 Quote Link to comment Share on other sites More sharing options...
+SpiceWare Posted December 3, 2022 Share Posted December 3, 2022 On 12/1/2022 at 4:51 PM, Frozone212 said: Commodore basic does not support the ELSE statement. Therefore, I am somewhat screwed with decision making While it's a little more complex, you can use GOTO to implement IF/ELSE logic. To cover multiple lines do this: 10 if 2 < 1 then goto 60 20 rem this is start of ELSE logic 30 print "in the ELSE block" 40 print "still in ELSE block 50 goto 90 60 rem this is start of IF TRUE logic 70 print "in the IF block" 80 print "still in IF block" 90 rem endif 1 Quote Link to comment Share on other sites More sharing options...
Frozone212 Posted December 4, 2022 Author Share Posted December 4, 2022 I will do that. anything else? Quote Link to comment Share on other sites More sharing options...
Casey Posted December 10, 2022 Share Posted December 10, 2022 You can sometimes use ON .. GOTO to simulate IF/THEN/ELSE: 10 IF A$="THIS" THEN 20 ELSE 30 Becomes: 10 ON (A$="THIS")+2 GOTO 20,30 This relies on the fact that if A$="THIS" is true, it is assigned the value -1 (except on Applesoft, where it is assigned the value 1), and if A$="THIS" is false, it is assigned the value 0. Adding 2 to the result makes it 1 for the true result, and 2 for the false result. You'll need to add a GOTO or something to skip around the code for the false result (so the true result doesn't fall through to the false result). You can also do this with GOSUB: 10 ON (A$="THIS")+2 GOSUB 20,30 11 STOP:REM OR GOTO SOMEWHERE ELSE 20 PRINT "TRUE":RETURN 30 PRINT "FALSE":RETURN 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.