Handy Instruction Manual
25"PRINT" and Variables
The following will introduce the basic instructions required for writing programs. Please make sure to read it if you're new to programming.
Print Characters - PRINT Instruction
"PRINT" is an important instruction that displays characters on the screen. Please try inputting the following program.
Once you have input the program, run it in DIRECT mode.
The PRINT instruction prints character strings enclosed in double quotations as-is.
◆How semicolons (;) and commas (,) work
Input ; (semicolon) to the right of "HELLO" on the first line, and then run the program.
"HELLO" and "A" have now been joined together.
Normally, the PRINT instruction causes a line break to occur automatically after printing the specified character string. However, if you add a semicolon (;), subsequent characters will follow directly after the printed string.
Next, change the semicolon (;) to a comma (,).
If you use a comma (,), subsequent characters will be printed after a set space.
The Difference between "A" and A - Understanding Variables
What will happen if you forget to insert double quotations when you were supposed to input PRINT "A"?
0 is displayed. This is because A without double quotations means "variable A."
◆What is a variable?
Computers contain lots of memory, which can store numbers and characters in individual pieces.
In BASIC, pieces of memory that store values are managed by giving them names. A piece of memory that has been given a name is called a "variable."
"PRINT A" without double quotations means "print the contents of the variable A" instead of "print the character A".
In this case, the contents of the variable A happened to be 0, so 0 was printed.
More details about variables are explained on the next page.
Print Characters from a Chosen Location - LOCATE Instruction
You can use the LOCATE instruction to specify the location (coordinates) at which characters should be printed with the PRINT instruction.
Format | LOCATE X-coordinate, Y-coordinate
|
---|
The following program prints HELLO at the position X=10, Y=3.
◆The depth of characters can also be specified
You can also specify the depth location (Z-coordinate) to display at. This can be used to achieve 3D effects when in 3D mode.
Format | LOCATE X-coordinate, Y-coordinate, Z-coordinate
|
---|
e-manual.pdf (3.0 MB)
Contents
- 1
Basic Information
- 2345678
Introduction
- 9About SmileBASIC
- 10Using SmileBASIC
- 11About BASIC
- 12About the TOP MENU
- 13Projects in the Cloud
- 14Managing Projects / Files
- 15Options
Create Programs
- 16Starting BASIC
- 17Using the Keyboard
- 18What is DIRECT Mode?
- 19Writing in EDIT Mode
- 20Features in EDIT Mode
- 21Managing Programs
- 22About Sample Programs
- 23Using the HELP Tool
- 24Using the SMILE Tool
Introduction to BASIC
- 25"PRINT" and Variables
- 26Using Variables
- 27Conditional Judgment
- 28Computer Colors (RGB)
- 29Graphic Instructions
- 30Sound Instructions
Further Information
- 31
- 323D Effects
- 33Screen Layout
- 34BG (Backgrounds)
- 35Sprites
- 36