18,700
edits
m (→string: wording) |
(→Data types: mentioning automatic initialization) |
||
Line 291: | Line 291: | ||
==Data types== | ==Data types== | ||
When declaring a variable or a function (more on this under the [[#Functions|Functions]] and [[#Variables|Variables]] sections), you must specify the type of data it contains, accepts, or returns | When declaring a variable or a function (more on this under the [[#Functions|Functions]] and [[#Variables|Variables]] sections), you must specify the type of data it contains, accepts, or returns. You can choose from "bool" (can be true/false), "int" (can be any whole number), "float" (a value with a decimal point), or "string" (some text). | ||
var int x; | var '''int''' x; | ||
func | var '''bool''' happy_bomber = true; | ||
func '''string''' my_func(void) | |||
{ | |||
... | |||
} | |||
Upon declaration, variables are automatically initialized to zero if no value is assigned explicitly, as in the above example with "x". | |||
===void=== | ===void=== |