News:

Function Finder  Find all the functions within source code files

Main Menu

Help with CONTINUE command example

Started by Berbalang, March 30, 2006, 01:43:45 AM

Previous topic - Next topic

Berbalang

PLEASE IGNORE THIS POST:

I've re-read what the example said. I was expecting only numbers 1-3 to be printed so when I saw a list of numbers I assumed all 10 had appeared. When I looked closely, however, I could see that 4 was not displayed. I think I just learned a valuable lesson.

Hi,

I'm new to PlayBasic. Heck I'm new to programming, and I'm trying to learn as much about PlayBasic as I can in order to make a game. However, some of the HELP examples don't seem to work. In this case I'm having trouble understanding the CONTINUE command.

Example:

CONTINUE
One final command to be aware of that can be used with any of the loop command sets is the CONTINUE command. Simply put this allows us to jump to the end command in a loop. Eg:


 FOR t=1 to 10
    IF t=4 THEN CONTINUE
    PRINT t
 NEXT t
 
 SYNC
 WAITKEY


In this example the number "4" will never be printed as the CONTINUE command causes PB to jump straight to the NEXT command bypassing the PRINT.

However, when I run this program it lists all the numbers from 1 to 10. Am I missing something?

Many thanks for your help.

Berbalang

PLEASE IGNORE THIS POST

kevin

#1
Berbalang,

QuoteI've re-read what the example said. I was expecting only numbers 1-3 to be printed so when I saw a list of numbers I assumed all 10 had appeared. When I looked closely, however, I could see that 4 was not displayed. I think I just learned a valuable lesson.

 Looking at the examples & help, I think thats prolly a very easy mistake to make.  So i've tweaked them a little more.  Both should be a little more obvious now.


  PlayBASIC Documentation: Continue

Tracy

No worries on the post. I was extra-green to the programming world as of a few months ago, and had more than my share of 'I-think-I-found-a-bug-oh-wait-I'm-just-doing-it-wrong" posts. The PB community's pretty forgiving, though, and I never had anything besides perfectly helpful response to my problems. I hope you have the same experience.

Welcome aboard. :)

Berbalang

Hi,

And thanks for the welcome. I'm really enjoying the learning experience. I hope to learn the PlayBasic inside out and then have a crack at designing a game. Fingers crossed.