programming:smilebasic:api_reference
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
programming:smilebasic:api_reference [2024-08-01 08:35] – Add Number section zlg | programming:smilebasic:api_reference [2024-08-09 03:11] (current) – [Value Ranges] remove redundancy zlg | ||
---|---|---|---|
Line 10: | Line 10: | ||
SmileBASIC supports variable names that are alphanumeric, | SmileBASIC supports variable names that are alphanumeric, | ||
+ | |||
+ | ===== System Variables ===== | ||
===== Types ===== | ===== Types ===== | ||
Line 36: | Line 38: | ||
===== Operators ===== | ===== Operators ===== | ||
+ | |||
+ | Every programming language has operators, and // | ||
+ | |||
+ | ==== Arithmetic ==== | ||
+ | |||
+ | These operators are your standard addition, subtraction, | ||
+ | |||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * ''/'' | ||
+ | * '' | ||
+ | |||
+ | ==== Comparison ==== | ||
+ | |||
+ | Comparison operators allow you to make decisions when you need to branch the behavior of a program with '' | ||
+ | |||
+ | * '' | ||
+ | * '' | ||
+ | * ''>'' | ||
+ | * ''<'' | ||
+ | * ''> | ||
+ | * ''< | ||
+ | |||
+ | These same operators can be used stand-alone in expressions to generate boolean values, which are typically '' | ||
+ | |||
+ | ==== Logical ==== | ||
+ | |||
+ | Logical operators are often combined with expressions that contain comparison operators in order to make meaningful decisions in the program. This means most " | ||
+ | |||
+ | < | ||
+ | Solution = Logical operations of expressions, | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | If you can abstract a problem into this framework, you are mastering logical operators. | ||
+ | |||
+ | * ''&&'' | ||
+ | * '' | ||
+ | |||
+ | The more legible '' | ||
===== Logic and Control Flow ===== | ===== Logic and Control Flow ===== | ||
- | ===== Input ===== | + | These functions or constructs are used to manipulate the flow, or structure, of your programs. |
+ | |||
+ | * [[# | ||
+ | * [[# | ||
+ | |||
+ | ===== Input/ | ||
+ | |||
+ | * [[# | ||
+ | * [[# | ||
===== Graphics Layering ===== | ===== Graphics Layering ===== | ||
===== Sound Effects and Music ===== | ===== Sound Effects and Music ===== | ||
+ | |||
+ | ===== DIRECT Mode Commands ===== | ||
===== Function Reference ===== | ===== Function Reference ===== | ||
This section is where all the " | This section is where all the " | ||
+ | |||
+ | ==== At sign (@) ==== | ||
+ | |||
+ | The sigil for a label for [[# | ||
+ | |||
+ | ==== CLEAR ==== | ||
+ | |||
+ | '' | ||
+ | |||
+ | Initializes the internal BASIC memory. | ||
+ | |||
+ | TODO: Does this also erase/ | ||
+ | |||
+ | ==== GOTO ==== | ||
+ | |||
+ | '' | ||
+ | |||
+ | Jump to the specified label in the code, and continue execution. | ||
+ | |||
+ | // | ||
+ | |||
+ | ==== INPUT ==== | ||
+ | |||
+ | '' | ||
+ | |||
+ | Accepts keyboard input and stores it into the given variable; an optional message can be included as a quoted string, followed by a semicolon ('';'' | ||
+ | |||
+ | ==== LOCATE ==== | ||
+ | |||
+ | '' | ||
+ | |||
+ | Position the text cursor at the given (X,Y) coordinates (in character cell units instead of pixels), with an optional Z coordinate if the Nintendo 3DS is in 3D Mode. | ||
+ | |||
+ | === Value Ranges === | ||
+ | |||
+ | ^ Axis ^ Range ^ | ||
+ | | X | 0-49 | | ||
+ | | Y | 0-29 | | ||
+ | | Z | -256-1024 | | ||
+ | |||
+ | The Z axis defaults to 0. | ||
+ | |||
+ | Any missing axes from a LOCATE call will be filled in with the last value used for that axis. All axes default to 0 if LOCATE is called after a CLEAR. | ||
+ | |||
+ | ==== PRINT ==== | ||
+ | |||
+ | '' | ||
+ | |||
+ | Output the given '' | ||
+ | |||
+ | Using a question mark before an expression is a shorthand for calling PRINT: | ||
+ | |||
+ | <code freebasic> | ||
+ | ?(7 + 2) ' outputs 9 | ||
+ | </ | ||
+ | |||
+ | String values can be concatenated with either the semicolon ('';'' | ||
+ | |||
+ | <code freebasic> | ||
+ | A$ = "beep " | ||
+ | B$ = " | ||
+ | ?(A$+B$) ' outputs "beep boop" | ||
+ | </ |
programming/smilebasic/api_reference.1722501355.txt.gz · Last modified: 2024-08-01 08:35 by zlg