<!-- Generated from applied-computing-au vic/unit3-4/sat/C06-2026/C06-Reference-Godot by port-reference-godot-to-wiki.py — do not hand-edit; re-run the port. --> # Data Types — GDScript **Skill codes on this page** | Code | Level | Skill | |---|---|---| | C613 | 1–2 | text data | | C614 | 1–2 | numeric data | | C615 | 1–2 | Boolean data | | C629 | 3–4 | outlines, in the internal documentation, why the selected data types were used | **Definition.** A *data type* classifies a variable: what data it can contain and how that data can be manipulated. At level 1–2 the skill is **identifying** the three data families in your own code. Using them with *stated* types is C628/C634 — see [Local and Global Variables](/sd/C06/Local%20and%20Global%20Variables). **Earns the tick:** one labelled line per family — text, numeric, Boolean — in code that runs. ## C613 — Text data **Definitions.** *Character:* a single meaningful unit — a letter, digit, punctuation mark, symbol or space. *String:* a sequence of characters. ### Character GDScript has no separate character type — use a one-character String: ```gdscript var chr_var: String = "A" # C613 — text: character ``` ### String ```gdscript var str_var: String = "Hello!" # C613 — text: string ``` ## C614 — Numeric data **Definitions.** *Integer:* whole positive and negative numbers. *Floating point:* computer representation of real numbers, with decimal places. *Numeric:* both families together. ### Integer ```gdscript var int_var: int = 42 # C614 — numeric: integer ``` ### Floating point ```gdscript var float_var: float = 3.14 # C614 — numeric: floating point ``` ## C615 — Boolean data **Definition.** A data type with one of two possible values, usually referred to as False and True. ```gdscript var bool_var: bool = true # C615 — Boolean ``` ## Spot them in a studied project ```gdscript # tile-matching-game — card.gd / game.gd var pair_id := "" # C613 — text: a String, inferred from "" var score := 0 # C614 — numeric: an int @export var flip_back_delay := 1.2 # C614 — numeric: a float var is_face_up := false # C615 — Boolean ``` These use `:=` inference — fine, as long as your comment names the type (see the warning in [Local and Global Variables](/sd/C06/Local%20and%20Global%20Variables)). ## Date/time No skill code of its own — it counts toward the level 9–10 *range* (C657). ```gdscript var dt_var = Time.get_datetime_dict_from_system() # counts toward C657 — range of types ``` That call returns a Dictionary of year, month, day, hour and so on — which is also a **record**; see [Data Structures](/sd/C06/Data%20Structures). ## C629 — Why these data types Level 3–4 asks you to **outline** the reason in internal documentation — a phrase is enough: ```gdscript var balance: float = 20.00 # C629 — float: money needs decimal places var card_id: String = "" # C629 — String: digits never used in a calculation ``` The reasons come from how each type behaves — the input/storage/output view is in [Data Type Characteristics](/sd/C06/Data%20Type%20Characteristics). **Also name it when you do it:** *casting* — converting a value from one type to another — is everyday Godot: `int($ZoneInput.text)`, `str(fares[0])`. ## Check Your Understanding 1. Name the three level 1–2 data families and their codes. >| ### Answer >| Text C613, numeric C614, Boolean C615. 2. Why does `var trips = 0` earn nothing for data types? >| ### Answer >| No type is stated or named in a comment — there is nothing for the marker to assess. 3. What is casting? Give one Godot example. >| ### Answer >| Converting a value between types — e.g. `int($ZoneInput.text)` turns the typed text into a number.
