2. Variables and Data Types
Learn Variables and Data Types through beginner-friendly explanations, working GOCO examples, and their expected output.
2.1 What are Variables?
Variables are like empty boxes where you can keep information. Each box has a name so you can find it later. Each box also has a 'type' that tells the computer what kind of thing is inside.
goco
Number age = 15.Sentence name = "Alex".Displaynl(name).Displaynl(age).
2.2 The Four Box Types
We have four kinds of boxes you can use: Number (for all numbers), Letter (for one single character), Sentence (for words and text), and Logic (for True or False values).
goco
Number myAge = 12.Number piValue = 3.14.Letter myGrade = 'A'.Sentence myPet = "Dog".Logic likePizza = True.// You can create a box without filling it right away.Number emptyBox.