One important element of making a program efficient, is to use correct types for your variables. When you've programmed for a while, type selection becomes natural, and you don't think much about it.

Some languages try to help the user by using automatic types. This is supposed to make it easier to write. P* does allow implicit converting between primitive types, but no variables can be typeless.

It is not much work to write `int`

or `string`

in front of a variable.
A good thing about this is that it helps make programs more readable, and it's an easy way for developers to make programs efficient.

Variables in P* are stored in memory as their C/C++ equalient type. Size of the type depends on the platform the interpreter is compiled on.

**Table 3.1. List of P* primitive types**

Name | Description | Example | C-equalient |
---|---|---|---|

int | Signed integer | int a = "-10"; | long int |

uint | Unsigned integer | uint a = 10; | long unsigned int |

llint | Long long signed integer | llint a = "-10"; | long long int |

lluint | Long long unsigned integer | lluint a = 10; | long long unsigned int |

float | Single precision floating point | float a = "2.00003"; | float |

double | Double precision floating point | double a = "2.00003"; | double |

bool | Boolean true or false (1 or 0) | bool a = 1; | bool |

string | String value | string text = "P* Web Programming Language"; | Uses `<string>` from C++ |

SCENE main { int base = 2; int exp = 1; int exp_max = 20; lluint result = 1; while (exp <= exp_max) { result *= base; echo "$base exp $exp is $result\n"; exp++; } } /* This program will output: 2 exp 1 is 2 2 exp 2 is 4 2 exp 3 is 8 2 exp 4 is 16 2 exp 5 is 32 2 exp 6 is 64 2 exp 7 is 128 2 exp 8 is 256 2 exp 9 is 512 2 exp 10 is 1024 2 exp 11 is 2048 2 exp 12 is 4096 2 exp 13 is 8192 2 exp 14 is 16384 2 exp 15 is 32768 2 exp 16 is 65536 2 exp 17 is 131072 2 exp 18 is 262144 2 exp 19 is 524288 2 exp 20 is 1048576 */