# If Statement Help?

if statement help

2 replies to this topic

### #1 Aether

Aether

Newbie

• Members
• 1 posts

• Calculators:
Casio fx-9750gii

Posted 05 February 2014 - 04:09 AM

I've very recently started learning how to program Casio calculators. I have an fx-9750gii. For some reason, the following doesn't seem to work:

If A=2 And B=1
Then "You just get past the lion."
Goto S
IfEnd
If A=2 And B=0
Then "You run out of energy."
"The lion catches you! You die."
"THE END"
Stop
IfEnd

Note that the EXE arrow and little pause staircase thing (don't know what they're actually called) is there - I just don't have it on my keyboard to show you all. I'm basically trying to make a text based game utilizing variables and if statements. In this particular part, I'm trying to make it so that if you have completed a certain action previously [B], then you get a certain outcome. [A] is the player's input (go back/run past the lion). It doesn't come up with a syntax error but it completely seems to skip the 'and' part of the statement. Also, I can't seem to start out under a label with an 'if' statement. I've also tried using an 'else' statement, but whenever I do it skips to the else bit and seems to disregard the 'if' statement altogether. Whenever I make these chains of if statements normally, it works - it's just when I use the 'and' or try to put if statements in if statements. Please help!

Edited by Aether, 05 February 2014 - 04:12 AM.

### #2 somebody1234

somebody1234

• Members
• 51 posts

• Calculators:
Casio fxcg10
Casio fx-9860GII

Posted 08 February 2014 - 12:14 AM

You can use the => command but it is a bit longer. (I am not very good at shortening programs.)
```A=2 And B=1=>"You just get past the lion."
A=2 And B=1=>Goto S
A=2 And B=0=>"You run out of energy."
A=2 And B=0=>"The lion catches you! You die."
A=2 And B=0=>"THE END"
A=2 And B=0=>Stop
```

Also, your post is a bit confusing.
Do you mean that this does not work?
```If A=2 And B=1
Then "You just get past the lion."
Goto S
Else If A=2 And B=0
Then "You run out of energy."
"The lion catches you! You die."
"THE END"
Stop
IfEnd
```

Edited by somebody1234, 08 February 2014 - 02:51 AM.

• flyingfisch likes this

### #3 Krtyski

Krtyski

Casio Freak

• Members
• 125 posts
• Gender:Male
• Location:Tokyo, Japan
• Interests:programming, smooth Jazz and 4-wheel driving.

• Calculators:
FX-502P, FX-602P, FX-603P,
fx-4000P, fx-7000G,
fx-4500P, fx-4800P
fx-5800P,
CFX-9850G,
CFX-9850GC PLUS
fx-9860G,
fx-9860G AU,
fx-9860G Slim
fx-9860GII SD,
fx-9860GII-2,
fx-9860GII-2 SD,
fx-CG20, fx-CG50,
fx-CP400

Posted 12 February 2014 - 06:10 AM

Where is Lbl S?

Without Lbl S, it probably tells you "Syntacs ERROR".
Try to add Lbl S, or delete Goto S.

### Also tagged with one or more of these keywords: if, statement, help

#### 0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users