Int

From ZCWiki
Jump to: navigation, search

The keyword int is used to define variables as integer types and to indicate that functions return integer values.

Examples

The first example demonstrates how to declare integer variables.

int Hitpoints = 32;

The second example demonstrates how to declare a function that returns an integer.

int GetHitpoints(){
  return Link->HP;
}

Details

As far as ZScript is concerned, the int data type is for the most part the same as the float data type. Variables defined as int can store positive or negative values, and can be used in math operations with floats without having to convert data types (see typecasting).

See Also