» Goto page 1, 2, 3  Next
IS>(

Definition:

IS>( stands for Increment and Skip and adds one to a variable. If the answer is greater that value, which also can be an expression, the next command is skipped; if the answer is <= value, then the next command is executed. variable cannot be a system variable.

Example:

Code:
``` 25->A IS>(A,10 Disp "A NOT > Disp "A > ```

Output:

A >

In simpler English:

What this does is it increments a variable and compares it to a value. If the answer is less than or equal to variable, then it skips the next command and goes on with the one after. If the answer is greater than variable, then it reads the next command. This is the basic If command, when used alone.

Note:

This command is not a looping command, it only compares values.

DS<(

Definition:

DS<( stands for decrement and skip and it subtracts 1 from variable, and then compares value to variable. If variable is less than value, the next command is skipped, and the calculator executes the following command. If the variable is greater than or equal to value, then reads the next commands and skips the one after.

Example:

Code:
``` 10->A DS<(A,25 Disp "A > Disp "A < ```

Output:

A <

In simpler English:

What this does is decrements (or decreases) variable and then compares to the preset value. If greater than or equal to, it executes the next command, and if less than, it skips and executes line after.

Note:

This is not a looping command, this just decreases a variable and compares values.
Comparable to:

Code:
```:25->A :A+1->A :If A>=10:Then :Disp "A NOT > :Else :Disp "A > :End```

Code:
```:10->A :A-1->A :If A>=25:Then :Disp "A > :Else :Disp "A < :End```
I always thought it repeated the section of code and incremented/decremented variable and skipped when variable is greater/less than value.
Common misconception. I used to think the same thing. I don't think I've ever actually used those in programs though.
So it would best be used like this:

Code:
``` :If X<21 :X+1->X :IS>(X,21 :" :"Would it be better than next line? Uses less mem right? :X+(X<21)->X```

About the misconception, that's what the manual told me...
Mmm, are you sure about that? I'll have to reread the manual, 'cause it's been forever since I actually had to consult it.
If you would like to consult the manual, consult the first post of this topic, as I just mainly reworded it. It is still the same concept...
I think they were originally designed to be used with labels:

Code:
```:5->A :Lbl 1 :your :code :here :IS>(A,10 :Goto 1```

Which does the same thing as:

Code:
```:For(A,5,10 :your :code :here :End```

The 2nd one, of course, being smaller and faster.
Of course. I think that they were kinda a waste of space though, and that TI should have used those tokens for more useful commands.
Ooh, parser/token hook idea. Replace those two with simple inc and dec commands.
Exactly!! That would be perfect: inc and dec would be 2+1=3 bytes instead of 5 bytes.
Heh, good idea. Also fix the App sorting you mentioned in the topic on DS if you get a chance.
Wow, TI's design is worse than we thought. The tokens for IS and DS are DA and DB, respectively... (that's one byte tokens)
The Tari wrote:
Wow, TI's design is worse than we thought. The tokens for IS and DS are DA and DB, respectively... (that's one byte tokens)
Exactly. They wasted two of the 1-byte tokens on IS and DS. :/
I wish they could've switched them with Delvar and something else useful...
Yeah, but that's TI for you. :/ For example, there's an undocumented bug in _InsertMem that changes a byte of one of the safeRAM areas.
An update, I finished writing the additions, but I haven't tested it. Either I'm doing something horribly wrong, or TI's emulator is evil and I need to get PTI. (I couldn't when I was testing because my internet connection was being patchy)
Cool. If it works out this is definitely something to consider for DCS.
Definitely. Any luck yet?

Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

»
» Goto page 1, 2, 3  Next
» All times are GMT - 5 Hours

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum