Getting Started
Write Coral code in the editor on the left. If your program needs inputs, enter them space-separated in the Program Inputs box. Press Execute to compile and get ready to run.
Execution Controls
- Execute / Edit
- Compiles your code and enters execution mode. Press again (labeled Edit) to return to editing.
- Step ▶
- Advances execution one step at a time. The current line is highlighted in the editor and flowchart.
- Run / Pause
- Runs the program automatically at the selected speed. Press again to pause.
- Speed slider
- Controls how fast Run advances. Leftmost = slowest (3 s/step). Rightmost = fastest (0.75 s/step).
- Instant ⏩
- Runs the entire program to completion immediately, showing the final output and variable values.
Status Bar
The colored dot and state label below the toolbar show what the simulator is doing:
- Edit Mode — you can modify code and inputs
- Ready — compiled successfully; press Step or Run
- Running — executing automatically
- Paused — mid-execution; resume with Run or advance with Step
- Complete — program finished; press Edit to start over
The detail area shows which sub-part of a loop or branch is being evaluated (e.g., for — checking condition). The step counter on the right tracks total steps taken.
Keyboard Navigation in the Editor
Inside the editor, Tab inserts three spaces (Coral requires 3-space indentation). To move focus out of the editor using only the keyboard, press Escape first, then Tab to advance to the next control.
The Variables Panel
The panel on the right shows all declared variables and their current values as execution proceeds. A dash (—) means the variable has been declared but not yet assigned. Array values appear as an expandable sub-table showing each index.
The Flowchart
Available for programs without user-defined functions. Switch to the Flowchart tab after pressing Execute. During stepping, the active node is highlighted in sync with the editor.
- Drag or scroll wheel — pan around
- + / − buttons — zoom in/out
- Fit button — reset zoom to fit everything on screen
- Keyboard (when flowchart is focused): + zoom in, - zoom out, 0 fit, Arrow keys pan
Sample Programs
The Load sample… dropdown loads pre-written examples into the editor and pre-fills the input area. Selecting a sample replaces any code currently in the editor.
Output Formatting
Use Put x to output to print a value. Add with N decimal places to control float precision (e.g., Put result with 2 decimal places to output). To print a newline, use a separate statement: Put "\n" to output.
Language Reference
The Coral language was created by Frank Vahid, Roman Lysecky, and Alex Edgcomb.
This simulator is an independent educational tool and is not affiliated with or endorsed by zyBooks.