Re: TIB: Reasons for not using other sub progs & other stuff...


[Prev][Next][Index][Thread]

Re: TIB: Reasons for not using other sub progs & other stuff...




Christopher Robin MacDougald wrote:
> 
> Greetings,
>         I've been PC programming for about 7 years. And when I started I used
> PUNCH CARDS... In fact I wasn't allowed to use the Apple IIe's until I
> had written a program in punch cards. Since then I've learned... Logo
> Writer, Apple Basic, QBasic, Pascal, C, C++, HTML, JavaScript, TI-Basic
> & Some ASM. Many of which I'm self taught. However I'm not proficient in
> any except Pascal, HTML, & JavaScript. Since PUNCH CARDS where my first
> programming experience I still program a little like I did with punch
> cards. The rule with punch cards it to write the program once and keep
> writing it until it can't get any smaller. But at the same time never
> lacking in user friendliness! This is why that if you look at my
> programs you'll see it. Even though it maybe only version 2.0 it's
> probably version 30 or so. I would often finish a game and then play all
> the possibilities and delete it just to see where I could make it
> smaller & more effecinet. I'll try and post my work on this list as soon
> as I get some more time... this weekend!!!
> 
> Jody: I'm curious as to WHY you don't use sub programs?
> Jody: How do you work around an area in your code that has to be used by
> more than one place?
> 
> Answer:
> One if it needs to be repeated in the program use a loop! And make sure
> you write it as small as you can get it!
> 
> Jody: I agree that Repeat seems to be the fastest. I think it is just a
> little bit faster than While. I'm not sure though, is Repeat faster than
> For(?
> 
> Answer:
> For is much faster than repeat I try and use For( when ever I can but in
> games... it often depends on the skill & patience's of the gamer... some
> are slow others are fast.
> 
> Jody: When you use repeat to quickly get out of a Repeat loop, how do
> you account for the "End"? Or do you use Goto to jump to just in front
> of the End, but still within the loop?
> 
> Answer:
> I use repeat w/in repeat! And I just keep track of which end goes with
> which repeat.
> 
> Jody I find this conversation very stimulating... It help you & I learn
> better programming and that I believe is one reason why this list was
> created! :-)
> 
> Christopher Robin MacDougald
> CRMacD@mail.utexas.edu
> http://pcrm.dorm.utexas.edu/

I agree that nesting looping can be quite effective. I think the 
biggest I've had was 5 loops going at once. However, I'm thinking more 
along the lines of having things that could come up more than once, 
but not necessarily at a given time or in any given order. Hmm.. I 
don't think this is coming across right. If you use Repeat, While, 
For...whatever...you MUST stay within those loops. If you have a 
Repeat nested in another Repeat, then the bigger repeat WILL happen 
when the smaller, nested repeat becomes false. 
The other thing that I was thinking of, was jumping out of a For( loop 
like the ways that were discussed earlier. If you put a Goto inside of 
a For( loop and then include an End at the site of the label - that 
won't work! For example;
:For(X,1,10
:If X=A
:Goto 1
:End
:Lbl 1 
:If X=A
:End
When the calc runs across the End, it will automatically return to the 
top of the For loop! Makes a mess, doens't it?

Jody Snider
jody1@alaska.net


Follow-Ups: References: