File: type.txt

package info (click to toggle)
colobot 0.2.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 415,536 kB
  • sloc: cpp: 129,246; ansic: 8,872; python: 2,158; sh: 672; awk: 91; xml: 35; makefile: 31
file content (33 lines) | stat: -rw-r--r-- 1,427 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
\b;Variable types
When you define a \l;variable\u cbot\var;, you must give two elements: 

1) a name
2) a type

Once you defined a variable, you can use it to put information in it. However, the information that a variable can contain must always be of the correct type: a variable of type \l;float\u cbot\float; can not contain a string, etc.

In a program, the name of a type is always displayed like that: \type;type\norm;. If the name of a type is not highlighted, this means that the name is misspelled. Type names are always written with lower case characters. Here is a list of the different types: 

\s;\c;\l;int\u cbot\int;\n;
For a whole number (12, -500, etc.).

\s;\c;\l;float\u cbot\float;\n;
For a real number (12, 3.14, 0.2, -99.98, etc.).

\s;\c;\l;bool\u cbot\bool;\n;
For a boolean variable, that can only take the values \c;true\n; or \c;false\n;.

\s;\c;\l;string\u cbot\string;\n;
For texts ("Hello!", "No object found", etc.)

\s;\c;\l;point\u cbot\point;\n;
For the coordinates of a point in space; a variable of this type consists of three parts named x, y and z.

\s;\c;\l;object\u cbot\object;\n;
A variable of this type contains the information about an object (bot, building, enemy, etc.).

\s;\c;\l;void\u cbot\void;\n;
This type is an "empty type", that you use when you do not want to specify a type.

\t;See also
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.