Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scrolling Tiles
#5
I think your gotos could be more descriptive, if you have to use them. Structured programming, of course, never uses them - though I am guilty of doing so Smile How about instead of goto 100 you used goto endofblock ?


What you're trying to do, though is escape multiple if's right?

So you began with

if test=1 then
do thing 1
end if

if test=2 then
do thing 2
end if

if test=3 then
do thing 3
end if

And elected to speed that up with:

if test=1 then
do thing 1
goto endofblock
end if

I believe? So that it doesn't do all the other tests?

In that case, you need to look at If / then / Else concepts, I think:

IF test=1 then
do thing 1
ELSEIF test=2 then
do thing 2
ELSEIF test=3 then
do thing 3
ELSE
do thing "not found"
END IF

It's one if, and it only tests until it finds a match, because ELSE doesn't run if the IF is true. If test=1 then it does thing 1, and gets out right there. if test=2 - it checks to see if test=1, finds it isn't so checks to see if test=2, finds it is, does thing 2 and goes to the END IF.

Does that help?
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)