This article is currently available in English. Your interface language stays selected.

01 · START HERE

Your first BASIC program

Learn how PRINT displays text, how comments explain your code, and why Cortex BASIC does not require line numbers.

Try these BASIC examples in the Web IDE Terminal.

Say hello with PRINT

A program is a sequence of instructions. In BASIC, PRINT sends a value to the text output. Put a message inside double quotes to treat it as text.

BASIC
PRINT "Hello, Cortex."

The expected text is:

EXPECTED OUTPUT
Hello, Cortex.

The quotes describe the string in your source. They are not part of the displayed message.

Leave yourself a note

A comment explains an idea to the person reading the program. An apostrophe starts a comment that continues to the end of the line.

BASIC
' My first Cortex program
PRINT "Hello, Cortex."
PRINT "A little code. A lot of possibility."

These instructions print two separate lines. The comment does not produce output.

You can leave the line numbers behind

Cortex accepts both numbered and unnumbered BASIC source. New programs do not need line numbers. Imported numbered programs retain their source numbers and branch targets. An editor gutter is a visual aid; its numbers are not automatically part of your program.

Make it your own

Change the two messages to describe something you want to build. Keep each message inside matching double quotes. Run this program from the Editor.

Next, give a value a name with variables and expressions.

← Back to Learn