Variables, Conditions, Loops, and Functions
Programming is just telling stories to a computer
In Part 1, you wrote your first GTLang program and learned that:
-
$means data -
@means action -
Indentation means structure
Now we move one step further.
At this stage, you are not “coding” yet.
You are simply explaining your thoughts to a machine.
And like every explanation, we start with memory.
1. Variables – Let the computer remember things
Humans remember names, numbers, and ideas.
Computers remember them using variables.
In GTLang, variables always start with a dollar sign $.
Creating a variable
Read it like this:
“Name is John.”
“Age is 24.”
No complicated keywords.
Just assignment.
Using variables
Output:
Variables help you:
-
Avoid repeating values
-
Change data easily
-
Make programs flexible
Multiple assignments (because life is short)
Simple. Clean. Human-friendly.
2. Conditions – Teaching the computer how to decide
Real life is full of choices.
-
If it rains, take an umbrella
-
If battery is low, charge the phone
-
If user is wrong, show a message
Programming is the same.
Basic if / else
Read it slowly:
If age is greater than or equal to 18
→ say “You are an adult”
Otherwise
→ say “You are under 18”
That’s it.
No parentheses.
No braces.
No noise.
Multiple conditions with elif
This feels close to natural thinking, not machine thinking.
3. Loops – When one time is not enough
Sometimes you don’t want to do something once.
You want to do it many times.
That’s what loops are for.
Simple loop: for ... times
Output:
Behind the scenes, GTLang creates a counter called $_time.
You can use it:
Output:
Simple loops are perfect for beginners.
Looping through a list (arrays)
Output:
No indexes.
No complex syntax.
Just values.
4. Functions – Teaching the computer new skills
Functions are reusable ideas.
Instead of writing the same logic again and again, you:
-
Give it a name
-
Describe what it does
-
Call it when needed
A simple function
Call it:
Output:
Functions with parameters
Call it:
Output:
Now your program can adapt, not just repeat.
Functions that return values
Use it like this:
Output:
This is where programming starts to feel powerful.
5. Why GTLang feels easy (on purpose)
Many languages force beginners to learn:
-
Types
-
Syntax rules
-
Compilers
-
Hidden errors
GTLang avoids that early pressure.
Instead, it teaches:
-
Thinking
-
Flow
-
Structure
-
Expression
Once you understand these ideas, any language becomes easier later.
Final thoughts – You are already programming
If you can:
-
Store values
-
Make decisions
-
Repeat actions
-
Create functions
Then you are already programming.
Not “almost”.
Not “beginner”.
Already.
GTLang just removes the fear, so you can focus on ideas first — syntax later.
In the next part, you can explore:
-
Arrays and objects
-
Working with files
-
Small real-world scripts
-
Writing clean, readable GTLang code
Take it slow.
Like green tea ☕🌱
