Reputation: 11
I'm making a game that requires some complex if statements, here is the code that doesn't work
If K=25 and not(Y=1) and not([A](X,Y-1)=1)
Then
... Other Code ...
End
but it works when I do
If K=25 and not(Y=1)
Then
If not([A](X,Y-1)=1)
Then
.. Other Code ..
End
End
What's the problem?
Upvotes: 1
Views: 45
Reputation: 64904
A problem with a condition such as not(Y=1) and not([A](X,Y-1)=1)
(by the way you can use the ≠
operator instead of combining not(
with =
) is that both sides of the and
in TI-BASIC are always evaluated (in contrast to how it works in many other languages). That means that if Y
is actually 1
, then the expression on the right hand side is still evaluated but it fails with an INVALID DIM
error. So, unfortunately, conditions like that must be split up.
Upvotes: 1