Values and variables
Programs need to remember information. A name, age, total, message, or answer can be saved under a clear name and used later.
In Creole, the information is a value. The name that holds it is a variable.
Set name to "Asha".
Show name.The value is "Asha". The variable is name.
Choose names that explain the information they hold. Clear names make a program easier to read.
Set your first variable
Use Set to give a value to a name:
Set language to "Creole".
Set year to 2026.
Set ready to true.Use the names in later instructions:
Show language.
Show year.
Show ready.Creole reads the program from top to bottom. A variable must receive a value before an instruction uses it.
Read a variable naturally
Compare these instructions:
Set city to "Mumbai".
Show city.You can read them as simple steps:
- save the text
"Mumbai"under the namecity - show the value stored in
city
Quotes distinguish text from a variable name:
Show "city".
Show city.The first instruction shows the word city. The second shows the value saved in the variable.
Other ways to save a value
Creole provides readable alternatives when they fit the sentence better:
Remember language as "Creole".
Let score be 10.
Set active to true.Set, Remember, and Let all create a clear name for a value.
For most examples in these guides, Set is used because it is short and direct.
Text values
Text is written inside double quotes:
Set first_name to "Asha".
Set greeting to "Welcome to Creole".
Set empty_text to "".Text can contain letters, numbers, spaces, and punctuation:
Set message to "Your order number is 2048.".
Show message.The period inside the quotes belongs to the message. The final period completes the Creole instruction.
Join text and values
Use followed by to build text from smaller values:
Set name to "Asha".
Set greeting to "Hello, " followed by name.
Show greeting.The result is:
Hello, AshaYou can also use a saved value directly in another instruction:
Ask "What is your city? " and store the answer in city.
Show "You live in " followed by city.Give text variables meaningful names such as name, city, message, or file_name.
Work with text
Creole includes common text operations:
Set greeting to "Hello from Creole".
Set loud to uppercase of greeting.
Set size to length of greeting.
Show loud.
Show size.Here:
uppercase of greetingcreates uppercase textlength of greetingreturns the number of characters- the original
greetingremains available
Save a changed value under a new name when both forms are useful.
Number values
Numbers do not use quotes:
Set age to 20.
Set price to 49.95.
Set below to negative 5.A quoted number is text, not a number:
Set item_count to 5.
Set room_code to "205".Use a number when you need mathematics. Use text when the digits are a name, code, phone number, or other label.
Calculate new values
A calculation can be saved like any other value:
Set price to 40.
Set delivery to 5.
Set total to price plus delivery.
Show total.Common math words include:
plusminustimesdivided byremainder of
Examples:
Set total to 10 plus 5.
Set difference to 20 minus 8.
Set area to 4 times 8.
Set half to 20 divided by 2.
Set remainder to 17 remainder of 5.The result of each calculation is saved under its variable name.
True and false values
A truth value can be either true or false:
Set signed_in to true.
Set has_error to false.Do not put quotes around truth values:
Set ready to true.This stores a truth value. Writing "true" would store ordinary text instead.
Truth values become especially useful with decisions. The next chapter explains how a program chooses what to do.
The nothing value
Use nothing when a useful value is not available yet:
Set selected_user to nothing.
Set last_error to nothing.nothing is different from empty text and zero:
Set no_value to nothing.
Set empty_value to "".
Set zero_value to 0.These values have different meanings:
nothingmeans no value is currently present""means text is present but empty0is the number zero
Change a variable
A variable can receive a new value:
Set score to 10.
Show score.
Set score to 15.
Show score.The second Set replaces the value stored in score. It does not change the earlier program output.
Variables are useful for information that changes while a program runs, such as a score, status, count, or response.
Keep the old value when needed
Save a result under another name if the original value is still useful:
Set price to 100.
Set discount to 15.
Set final_price to price minus discount.
Show price.
Show final_price.Now the program has both the original price and the final price.
Receive a value from a person
Ask saves the person's answer in a variable:
Ask "What is your name? " and store the answer in name.
Ask "What are you building? " and store the answer in project.
Show "Hello, " followed by name.
Show "You are building " followed by project.Input received from the terminal starts as text. Give each answer a clear variable name so later instructions are easy to understand.
Convert input into a number
Ask always returns text. Convert numeric input explicitly before using it in mathematics:
Ask "Enter a number: " and store the answer in number_text.
Set number to number from number_text.
Set doubled to number times 2.
Show doubled.Keep the names separate while learning:
number_textis the original terminal textnumberis the converted numeric valuedoubledis the calculation result
Whole-number text becomes a whole number. Decimal text becomes a decimal number.
Set whole to number from "25".
Set decimal to number from "3.5".If the text is not a valid number, Creole stops with a clear error. Do not use an unconverted answer directly in arithmetic.
Convert a value into text
Use text from when you need a text representation of a value:
Set score to 42.
Set score_text to text from score.
Show score_text.Read the type of a value
Use type of when a program needs to inspect a value:
Set answer_text to "42".
Set answer to number from answer_text.
Show type of answer_text.
Show type of answer.The first type is text; the second is number.
The input-to-output path
A reliable program makes each stage visible:
input → conversion → operation → validation → outputFor a small calculator:
Ask "First number: " and store the answer in first_text.
Ask "Second number: " and store the answer in second_text.
Set first to number from first_text.
Set second to number from second_text.
Set total to first plus second.
Show "Answer: " followed by total.This explicit flow helps readers, tools, and AI coding systems avoid inventing automatic conversion behavior.
Use values across clear steps
A readable program often builds its result in small steps:
Set product to "Creole Guide".
Set price to 40.
Set delivery to 5.
Set total to price plus delivery.
Set summary to product followed by " is ready".
Show summary.
Show total.This is easier to check than hiding many unrelated actions inside one instruction.
Name variables clearly
Good variable names explain their purpose:
Set customer_name to "Asha".
Set total_price to 45.
Set request_ready to true.Avoid names that do not explain the value:
Set x to "Asha".
Set thing to 45.
Set value2 to true.Short names are useful only when their meaning is obvious.
Simple naming rules
Use names made from letters, numbers, and underscores. Start with a letter and use underscores between words:
name
user_name
item2
final_priceKeep names consistent. Do not call the same idea user_name in one place and person_text in another without a reason.
Common mistakes
Missing quotes around text
Incorrect:
Set city to Mumbai.Correct:
Set city to "Mumbai".Without quotes, Creole may treat Mumbai as a name instead of text.
Using a variable before setting it
Incorrect:
Show message.
Set message to "Hello".Correct:
Set message to "Hello".
Show message.Quoting a variable name
Set name to "Asha".
Show "name".This shows the word name. To show the saved value, write:
Show name.Using unclear names
A program full of names such as x, a1, and temp2 becomes difficult to maintain. Rename them according to their purpose.
Practice program
Create values.crlo:
Set language to "Creole".
Set lessons_finished to 2.
Set next_lesson to lessons_finished plus 1.
Set learning to true.
Ask "What is your name? " and store the answer in name.
Set greeting to "Welcome, " followed by name.
Show greeting.
Show language.
Show next_lesson.
Show learning.Check it:
creole --check values.crloRun it:
creole values.crloLearning checklist
- I know the difference between a value and a variable.
- I can save text with quotes.
- I can save numbers without quotes.
- I can use
true,false, andnothing. - I can join text with
followed by. - I can calculate and save a new number.
- I can replace a variable's value.
- I can convert input with
number from. - I can inspect a value with
type of. - I can choose clear variable names.
- I can check and run a
.crlofile.
Next step
You can now save, read, combine, calculate, and update values in a Creole program.
Continue to Decisions and loops to learn how a program chooses between actions and repeats work.