[TI-BASIC] I sound noobish...

Got questions? Got answers? Go here for both.

Moderator: MaxCoderz Staff

Post Reply
User avatar
ProphetsDementia
Regular Member
Posts: 81
Joined: Wed 06 Dec, 2006 2:20 am
Location: Tokyo, Kanto, Japan

[TI-BASIC] I sound noobish...

Post by ProphetsDementia »

Is there a limit to how many nested 'If-Then's you can have in one?

Example:

Code: Select all

If K=92:Then
If L=23:Then
If A=2:(execute code)
End
End
User avatar
Xphoenix
New Member
Posts: 27
Joined: Sun 10 Jun, 2007 3:58 pm
Location: North of the south pole

Post by Xphoenix »

Nope. No limit. But your instance above, if that is your code, could be

Code: Select all

If K=92 and L=23 and A=2
(execute code)
ImageImage
I don't have them, but no one can stop me :)
User avatar
ProphetsDementia
Regular Member
Posts: 81
Joined: Wed 06 Dec, 2006 2:20 am
Location: Tokyo, Kanto, Japan

Post by ProphetsDementia »

You can use multiple 'And' statements?
"Choice. The problem is choice."
"Quite correct. Strange; that was quicker than the others."
"Others?"

"In your case, this is the sixth version of the Matrix."
"Sixth version? Then, either no one told me or no one knew."
User avatar
Xphoenix
New Member
Posts: 27
Joined: Sun 10 Jun, 2007 3:58 pm
Location: North of the south pole

Post by Xphoenix »

Multiple or, and ,not(, xor, whatever.

You can also use combinations, like

Code: Select all

If X=Y or X=Z and A=B or A=C
But remember the priority ladder (that's what I call it).

and comes first, then or, then xor. So

Code: Select all

If A=B or A=C and B=C
would be like

Code: Select all

If A=B or (A=C and B=C)
but you save a few bytes by excluding the parenthesis.

-------------------------------------------

So if A=1, B=2, and C=1,

Code: Select all

If A=B or A=C and B=C
(A=B)=0
(A=C)=1
(B=C)=0

Code: Select all

If 0 or 1 and 0
(1 and 0)=0
(0 or 0)=0

So that would evaluate to 0, or false.
Last edited by Xphoenix on Mon 11 Jun, 2007 2:49 am, edited 1 time in total.
User avatar
ProphetsDementia
Regular Member
Posts: 81
Joined: Wed 06 Dec, 2006 2:20 am
Location: Tokyo, Kanto, Japan

Post by ProphetsDementia »

Slightly confused, but okay. Thank you.
"Choice. The problem is choice."
"Quite correct. Strange; that was quicker than the others."
"Others?"

"In your case, this is the sixth version of the Matrix."
"Sixth version? Then, either no one told me or no one knew."
User avatar
Xphoenix
New Member
Posts: 27
Joined: Sun 10 Jun, 2007 3:58 pm
Location: North of the south pole

Post by Xphoenix »

I might have included too much stuff in my post above. The only important thing is the stuff above the line a typed.
ImageImage
I don't have them, but no one can stop me :)
Post Reply