Question

I found a program I made on my calculator many years ago, and I am having trouble understanding what the line

Z-1(Z=0 → Z

does in it. I tried just changing it to

Z-1 → Z

but that ended up breaking it. Here is an excerpt, any information would be helpful!

ClrHome
Prompt A,B,C
A*C → D
B-1 → Z
Z-1(Z=0 → Z
D/Z → F
F+Z → G
Was it helpful?

Solution

This is pretty common for complex variable trickery without if statements and such. This is pretty much saying if Z=0, subtract 1 from Z. If Z isn't 0, Z=0 becomes 0, and Z-1(0 (order of operations is multiply first) is just Z-0, which will leave the variable unchanged. In normal code it would be like:

If not(Z
Z-1->Z

Just another thing to point out, If not(Z[newline] and (Z=0 have the same amount of tokens, which means you should do (not(Z instead to save space. Never in ti basic should you really have a =0 because that is 2 tokens for something not( can do in one.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top