If

From Game Editor

Revision as of 18:42, 25 November 2009 by Asmodeus (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Use the keyword if to check if something is true.

Here are some simple examples:

int center = 0;
if(x == 0) center = 1;
int center;
if(x == 0) center = 1;
else center = 0;
FILE *fp = fopen("myfile", "r+t");
if(fp)
{
  // your code here
}
fclose(fp);

Note that if(fp) is the same as if(fp != 0).

Note: Don't forget to have the equal signs twice.

Retrieved from "http://game-editor.com/If"