Qbasicnews.com

Full Version: code speed
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Now, whats about "select case"/"switch()"?
I asume that he tests until a result is reached and ingnores the rest.

So, when i have this:

Code:
select case test
  case 1:
    print "Thats happening"
  case 2:
    print "Not happening"
  case 1:
    print "Dont know if this will happen"
end select
So, what do you think?
Ill go and test it with FreeBASIC and give a result in a moment

EDIT: Just the first case 1: is executed
For example, that in C is different, as it keeps executing until it reaches a break;.
Time your programs. Not sure of an easy way to do this in Windows, nor do I know enough QB itself to know how. Calculate the current time, then calculate the time at the end, subtract the value and output. Do that for both programs and find the answer. If you're interested in this kind of thing, check out this slightly related link: http://www.scism.sbu.ac.uk/law/Section5/...5c1p2.html
it is hard to time the program being that it is on my calculator. there is no elseif ( but if then else) or case select. i'm using TI-83 plus BASIC, NOT computer QB.
I tried making a game for my calc (TI-84p), but it ran waaaaay slow. It was a side scroller shooter thing, with an fps around 1 :lol:

I dunno what I did wrong, the code was tiny, and besides, the TI-84 is supposed to be faster than 83 right?
Well those calcs isn't the ideal thing to interpret basic commands
in realtime Zap Wink

@Diroga: Use a stopwatch. While not being the most efficient way,
if you run it in a long enough loop the difference should be discernable.
Pages: 1 2