# If Statement Question [SOLVED]

Hello all!

I’ve got a quick question for you all. The if statements in regards to numerical values is really giving me a fit. I just can’t seem to find the proper syntax in calculating numbers. Here I am attempting to have the computer read a variable Oxygen to see if it is zero and if not, subtract one. Can you tell me what i’m doing wrong?

``````Oxygen is a number that varies. Oxygen is 60.

Every Turn:
If the Oxygen is 0:
say "You have died";
otherwise:
Oxygen = Oxygen - 1 ``````

Either

``now oxygen is oxygen - 1``

or

``decrease oxygen by 1``

or just

``decrement oxygen``

See ch. 8.12. in the manual.

Juhana,

Thank you for the answer and the reference. I’ve been pouring over the manual and recipe book for a few days now. Thanks!

Got one more question and that should be it. What is wrong with this code?

``````Every Turn:
If oxygen equals 0:
say "Your computer begins to beep and the oxygen meter reads red. As the oxygen fades from your suit the last you see is Saturn above the horizon. ***You have Died***";
end the story;
otherwise:
decrease oxygen by 1.``````

The error I get is:

Problem. In the sentence ‘If oxygen equals 0 begin’ , I was expecting to read a condition, but instead found some text that I couldn’t understand - ‘oxygen equals 0’.

I was trying to match this phrase:

if (oxygen equals 0 - a condition):

This was what I found out:

oxygen equals 0 = something unrecognised

Try “is” instead of “equals.”

That was it! Thanks!