REBOL 3 Docs Guide Concepts Functions Datatypes Errors
  TOC < Back Next >   Updated: 8-Feb-2009 Edit History  

REBOL 3 Usage: Using the Console

Whenever you run REBOL/Core, it opens a console to display output and accept input. If you provide a script argument to the program, the script is run, and you see the output from that script. If you do not provide a script file, the console prompts you for input. The input prompt looks like this:

>> ==

For example:

>> 100 + 20
== 120
>> now - 7-Dec-1944
== 20341
Changing the Prompt

The prompt characters can be changed. See the [bad-link:concepts/console.txt] Appendix for more information.

The console also becomes active if a script encounters an error or if the script calls the halt function.


Mulitple Line Input

If you begin a block on the command line and don't end it, the block is extended to the next line. This is indicated by a prompt that begins with a bracket and is followed by indentation. The line will be indented four spaces for each open block. For example:

loop 10 [
[    print "example"
[    if odd? random 10 [
[        print "here"
[        ]
[    ]

This is also true for multilined strings enclosed in braces.

Print {This is a long
{    string that has more
{    than one line.}

Brackets and braces that appear within quoted strings are ignored. You can escape from input at any time by pressing the ESCAPE key.

Interrupting a Script

A script can be interrupted by pressing the ESCAPE key, which returns immediately to the command prompt.

During some types of operating system or network activity there may be a delay in responding to the ESCAPE interrupt.

History Recall

Each line that is typed into REBOL is stored for later recall. The up and down arrow keys are used to scroll through the list of previous lines. For instance, pressing the up arrow once recalls the prior input line.

History lines can be written to a file by saving the history block. See the [bad-link:concepts/console.txt] Appendix for more information.

Word Completion

To help speed typing of long words and file names, the REBOL console has word and file name completion. After typing a few letters of a word, press the tab key. If the letters uniquely identify the word, the rest of the word is displayed. For example, typing:

>> sq

then pressing tab results in:

>> square-root

If the letters do not uniquely identify the word, you can press tab again to get a list of choices. For example, typing:

>> so

then pressing tab twice results in:

>> sort source


and you can type the rest of the word or enough of it to be unique.

Completion works for all words, including user-defined words. It also works for files when they are preceded by a percent sign.

>> print read %r

Pressing tab might produce:

>> print read %rebol.r

depending on your current directory.

Busy Indicator

When REBOL waits for a network operation to complete, a busy indicator appears to indicate that something is happening. You can change the indicator to your own character pattern. See the [bad-link:concepts/console.txt] Appendix for more information.

Network Connections

As network connections are initiated, a message appears on the console. For instance, typing:

>> read
connecting to:

If necessary, you can disable this output by setting the quiet flag. See the [bad-link:concepts/console.txt] Appendix for more information.

Virtual Terminal

The console provides virtual terminal capability that allows you to perform operations such as cursor movement, cursor addressing, line editing, screen clearing, control key input, and cursor position querying.

The virtual terminal uses the standard ANSI character sequences. This allows you to write platform-independent terminal programs such as text editors, email clients, or telnet emulators.

More information can be found in the [bad-link:concepts/console.txt] Appendix.

  TOC < Back Next > - WIP Wiki Feedback Admin