GD Script Flashcards

1
Q

What is a constant and it’s naming format

A

A constant is a value that cannot be changed
Write names in CAPS with _ beween words -
ie const DAVID_PILK

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a dynamic variable and how does it apply to Godot

A

a dynamic variable means you do not have to name the variable type and the type can change in the program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a keyword

A

words reserved by GD script such as var or enum, cannot be used as identifiers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Types of numbers

A

Integer - a whole number,
float - a number with a decimal
constant - a number that doesn’t change

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Define Enum

A

a list of constants

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Variable name format

A

lower-case text, join words with underscores this_variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

types of variable

A

int, bool, float and string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

static typing

A

where you declare what type a variable is - ie var name : string = “David”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Global scope vs local scope

A

determines where a variable is accessible from

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Data type

A

An attribute which tells the computer how a programmer intends to use the data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What do data types do?

A
  1. Define the types of operations that can be done on the data
  2. How the values can be stored
  3. The meaning of the data
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Literal value, alternate name and what it is

A

Literal

A value stored directly in the source code, without referencing something else

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Null?

A

Represented by null in the code

Represents - No data type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

When to use floats over integers

A

When more accuracy is needed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

In Boolean values which is true and which is fakes, 0 or 1?

A
False = 0
True = 1
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

If you don’t assign a value to a variable what data type will it contain?

A

Null

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is a typed variable?

A

A variable where the data type is specified

Ie var name : string = “Sap”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Casting?

A

Changing a variable type to another variable type ie “10” to 10

19
Q

What is the casting operator

A

As

ie. var amount : int = “10” as int

20
Q

When to use a variable?

A

When you have a datatype that may change over the course of the game

ie var health : int = 100

21
Q

Memory Life Cycle

A

Allocate
Use
Release

22
Q

What system allocates memory

A

The OS

23
Q

Operator

A

A symbol used to manipulate operands ie. + * etc

24
Q

What is an Operand?

A

A number, Boolean or string

ie. 1 +2 - the operands are 1 and 2

25
Q

Assignment operator

A

Assign a value to its left operand based on the value of its right operand

ie x = y

26
Q

Remainder assignment

A

%=

27
Q

Additional assignment?

A

+=

28
Q

Subtraction assignment

A

-=

29
Q

Multiplication assignment

A

*=

30
Q

Devision assignment

A

/=

31
Q

What are comparison operands

A

Compares two values and reruns a result based on if the answer is true

32
Q

Equal operator

A

==

33
Q

Not equal operator

A

!=

34
Q

Greater than or equal to

A

> =

35
Q

Less thank or equal to

A

<=

36
Q

Not symbol

A

!

37
Q

And symbol

A

&&

38
Q

Or symbol

A

||

39
Q

Can a constant have a null value?

A

No

40
Q

Can you change a constants type? Ie string to int

A

No

41
Q

Three benefits of using constants?

A

Readable code
Easier debugging
Save time when editing code

42
Q

When to use constants?

A

When you have a value you don’t think will change for the lifecycle is the game

43
Q

Naming conventions for constants vs variables

A
const NAME = 
var name =