Home Learn Explore About ⭐ GitHub
 📚

Learn FLang!

Step-by-step lessons — from zero to coding hero! Each lesson builds on the last. Let's go!

1
📦
Variables — Your Label Boxes

A variable is like a labeled box where you store information. Think of SET as putting something in a box!

SET my_name TO "Robot"
SET score TO 100
SET is_fun TO true
📝 Text (Strings)

Wrap text in double quotes: "Hello"

🔢 Numbers

Just write the number: 42 or 3.14

✅ True/False

Use true or false (no quotes!)

📋 Lists

Use square brackets: [1, 2, 3]

You can name your variables anything! Use underscores for spaces like my_score.

🧠 Quick Check! How do you create a variable in FLang?

2
🖨️
DISP — Show Stuff on Screen

DISP (short for Display) lets you print things to the screen. It's like telling the computer to say something out loud!

DISP "Hello, World!"
DISP score
DISP "Your score is: " + score
Use the + operator to join text and variables together!
3
🤔
Making Decisions — IF, ELIF, ELSE

Sometimes we want the computer to make choices. We use IF, ELIF (else-if), and ELSE for this!

SET age TO 10
IF age > 12:
DISP "You are a teenager!"
ELIF age < 5:
DISP "You are a toddler!"
ELSE:
DISP "You are just right!"
⚖️ Comparison Operators

> Greater than
< Less than
>= Greater or equal
<= Less or equal
= Equal to

🔗 Logical Operators

& means AND
| means OR
! means NOT

Always remember the colon : at the end of IF, ELIF, and ELSE lines!

🧠 What does ELIF stand for?

4
🔄
Loops — Do Things Over and Over!

Loops let the computer repeat actions many times. There are two kinds of loops in FLang!

🔁 FOR Loop

Use when you know how many times to repeat.

⏳ WHILE Loop

Use when you repeat until something changes.

-- FOR loop: print 1 to 5
FOR range( 1, 6 ) AS i:
DISP i
-- Loop through a list
SET fruits TO [ "apple", "banana", "mango" ]
FOR fruits AS fruit:
DISP fruit
-- WHILE loop
SET counter TO 0
WHILE counter < 3:
DISP "Still going!"
SET counter TO counter + 1
NEXT — Skip to next round of the loop (like Python's continue)
END — Stop the loop completely (like Python's break)
Don't forget to increase your counter in a WHILE loop or it runs forever!
5
🎒
Lists — Collection of Things

A list is a collection of items stored in one variable. Think of it like a bag holding many things!

SET my_list TO [ 10, 20, 30, 40 ]
-- Get the first item (index 0)
DISP my_list[0] -- prints 10
-- Loop through the list
FOR my_list AS item:
DISP item
Lists start counting from 0, not 1! So the first item is at index 0.
6
Functions — Your Own Special Commands

A function is a reusable block of code you name and call whenever you need it. Use DEF to define one!

DEF say_hello(name):
DISP "Hello " + name + "!"
say_hello("Sam")
say_hello("Alex")
-- Function with RETURN
DEF add(a, b):
RETURN a + b
SET result TO add(5, 3)
DISP result -- prints 8
Functions help you avoid writing the same code twice. Write once, use many times!
7
🎤
ASK — Get Input from the User

Use ASK to ask the user a question and store their answer in a variable!

-- Ask for a number
SET age TO ASK INT "How old are you? "
-- Ask for text
SET name TO ASK STR "What is your name? "
DISP "Nice to meet you, " + name + "!"
🔢 ASK INT

Asks for a whole number. Perfect for scores, ages, counts!

💬 ASK STR

Asks for text. Perfect for names, answers, messages!

8
🚀
Running Your FLang Program

Save your code in a file ending with .fun and run it like this:

python -m flang your_file.fun

🎉 You finished the lessons!

Now go to the Explore page to discover all the built-in functions, or check out the GitHub repo to download FLang!