Recap - Simple Math
Part of the Fundamentals section of Coddy's GDScript journey. Lesson 19 of 92.
Challenge
EasyChange the values of a and b so that:
c, which holdsa * b, is24d, which holdsa / b, is6
Both are integers, so a / b drops the decimal part. Do not change the lines that declare c and d or the print() lines. The output must be:
c = 24
d = 6Try it yourself
extends Node
func _ready():
# Change the values of a and b
var a: int = 0
var b: int = 1
# Don't change the lines below
var c: int = a * b
var d: int = a / b
print("c = ", c)
print("d = ", d)
All lessons in Fundamentals
4Operators Part 1
Arithmetic OperatorsInteger DivisionModulo OperatorArithmetic ShortcutsRecap - Simple MathComparison Operators10Functions
Declare a FunctionArgumentsReturnReturn TypesRecap - Sigma FunctionRecap - Validation FunctionDefault Values5Operators Part 2
Logical Operators Part 1Logical Operators Part 2Recap - Simple LogicLogical Operators Part 3Ternary OperatorPractice on your own: Online GDScript compiler