Step 1 of 5 · Reading · ~3 min
Learn
Basics
Hello, BASIC
BASIC — Beginner's All-purpose Symbolic Instruction Code — was created at Dartmouth College in 1964 with a radical goal: computing for everyone, not just scientists with punch cards. It worked. By the early 1980s virtually every home computer booted straight into a BASIC prompt, and a generation learned to program on it. This course uses FreeBASIC (the fbc compiler): a free, modern compiler that keeps the classic QuickBASIC syntax but produces fast native executables. Your code here is genuinely compiled and run — same as C, just friendlier.
Your first program
PRINT "Hello, BASIC!"
That one line is a complete program. No class, no main function, no imports. This is BASIC's founding idea: the language should meet the beginner, not the other way around. Execution starts at the top of the file and runs downward, line by line.
Ground rules before anything else:
- Keywords are case-insensitive.
PRINT,print, andPrintare the same word. (Convention here: keywords in CAPS, like the classics.) - Text inside quotes is NOT case-insensitive.
"Hello"and"hello"are different strings — and the grader cares. - One statement per line. No semicolon terminators like C or Java.
- Comments start with
'(a single quote) or the old-schoolREM. The compiler ignores the rest of the line.
How PRINT separates things
PRINT writes its arguments, then moves to a new line. The separator between arguments controls spacing:
PRINT "one"; "two" ' onetwo (semicolon joins with NO space)
PRINT "one", "two" ' comma jumps to the next 14-column zone
PRINT "no newline yet";
PRINT " ...same line" ' a trailing ; suppresses the newline
The comma zones exist for quick table layouts on 1980s screens. For exact output — which is what graders check — prefer ; and put any spaces you need inside the quotes yourself.
The trap: unquoted text
PRINT Hello, BASIC! ' COMPILE ERROR
Without quotes, the compiler reads Hello as a variable name. FreeBASIC's default dialect requires variables to be declared before use, so this stops with a "variable not declared" error. Museum-era BASICs were worse: they silently invented the variable and printed 0. The modern dialect turns that silent bug into a loud one — that's a feature.
A peek at input
DIM n AS INTEGER
INPUT "", n
PRINT n * 2 ' for input 3 this prints " 6" — note the leading space
INPUT reads a value typed into the program. The empty "" prompt matters: plain INPUT n prints a ? prompt first, and on this platform that stray ? becomes part of your output and fails the match. DIM is variable declaration — the entire next lesson is about it, including that stray space in front of the 6.
Your exercise
Print exactly:
Hello, BASIC!
The starter is a single commented-out placeholder line; replace it with a real statement. The grader compares your line against the expected line, so these are the mistakes it catches every day:
Hello Basic!—BASICmust be ALL CAPS, and the comma afterHellois required.- Missing the
!at the end. - Submitting the starter untouched. A commented-out
PRINTproduces no output at all, and empty output never matches.
One honest note about the comparator, because guessing at it wastes attempts: it ignores whitespace at the end of your output. An accidental extra bare PRINT at the bottom adds a blank line and still passes. An extra line that has text on it does not.
Discussion
Ask a question, share an insight, or help someone who’s stuck.
Sign in to post a comment or reply.
Loading…