Re: 82 Prob.


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

Re: 82 Prob.



You haven't done much basic programming yet :-).

IF/THEN/END works just like that. The goto 0 business is useless here.

use of the IF statement.

IF <condition>
:Statement1

Statement 1 only get's executed when the IF condition is true.
if the IF condition is false, it SKIPS the next command.

NB:

:IF <condition>
:Statement1:Statement2

will NOT skip over Statement 2. you can only execute one command.

the IF/THEN/ELSE/END one:

:IF <condition>
:THEN
:<statementsA...>
:ELSE
:StatementsB...>
:END

That bit runs statementsA if the condition is true, and
StatementsB if the condition is false.

in other words, make your Lbl 0 statement END, and delete the Goto 0
statements.

> If T>10
> Then
> 35+Y /sto/ Y : 0 /sto/ T : 0 /sto/ X
> goto 0
> Else
> goto 0
> lbl 0

IF T>10
THEN
blahblahblah.....
END

since there is no code for your ELSE block, you can leave the
ELSE keyword out.
--
-R.Zwitserloot@BTInternet.com

David Endahl <endahld@SCNC.WMSTON.K12.MI.US> wrote in article
<3392BC02.74DA@scnc.wmston.k12.mi.us>...
> Hi all,
> I am having some trouble eliminating some goto's in a
> program that I've been editing.  The prog. is supposed to
> factor a number that you give.  Here's the problem:
> ....
> If T>10
> Then
> 35+Y /sto/ Y : 0 /sto/ T : 0 /sto/ X
> goto 0
> Else
> goto 0
> lbl 0
> .....
>
> Now I know that goto's are VERY BAD because they fill up the
> calcs memory quickly, but I can't find a way to get around
> this one.  Any help would be appreciated.  Thanx!
> -David
>


References: