You are not logged in.
Pages: 1
Basic as in simple. I'm trying to create an IF statement and having a lot of trouble. I want it to be IF 1<B<5, but it won't let me have the two signs. Also, how can I have it so only integers are allowed to be entered into prompts and inputs?
Offline
1. IF 1<B AND B<5
2. Depends on the calculator. On the 85, you can't force it to accept only integers (you either tell it to accept numbers or strings; for the former, it'll evaluate it as an expression and 'crash' if you give it a bad input), though the later calculators probably allow you to be more strict.
* Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
Offline
Also, how can I have it so only integers are allowed to be entered into prompts and inputs?
Repeat X=int(X
Prompt X
End
This will keep on doing prompt until X is integer. You can add stuff like a message to tell you to only add integers if a non integer value is inputted, or ClrHome to clear the screen every time it asks again (so your screen doesnt get flooded with 'X?')
Offline
On the older calculators (85, 86), you can't reference undefined variables, so you need to resort to something like this:
Prompt X
While X≠int(X
Prompt X
End
* Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
Offline
nah, you can always use 0->X before doing the repeat loop, to define that variable.
Offline
In that case, 0.1->X would work a bit better, but the overall effect is the same (though it'd take a few more bytes of code).
* Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
Offline
if you use Repeat it'll run at least once anyway. Repeat only checks at the end of the loop, so by then X will already exist.
Offline
I have an 83+ and I'm just finding something to do during math class. I'll definitely try these after I'm tired of my PSP.
Offline
Pages: 1