Elan code editor

To open the Elan code editor in a new browser tab, click https://elan-lang.org

Click on the File menu and choose New.

You will see the Elan version and the prompt showing all the Global keywords:

# 3dc077f604fb3b9338c8e0104060503ae108013df97a7fc82066915f81a30804 Elan 1.2.6 guest default_profile new code
main procedure function test constant enum record class abstract interface #

Press m on your keyboard, and the main routine will be entered into your code, displaying both a prompt for all the keywords you can use within main and a new code prompt at the global level.

+main new code
call each for if let print repeat set throw try variable while #
end main
new code

The prompt within main is already selected, so you can type, say, p and a print instruction will be entered with a field soliciting an expression, into which you can type (for example) a quoted string. The field will then have a green background indicating that the instruction is valid.

+main print new code
call each for if let print repeat set throw try variable while #
end main

The code shown in the editor has three types:

An instruction consists of keywords that cannot be edited or deleted, and fields that you may fill with values. See an example in 'A first instruction' above.

A selected field has a thin black border and a background colour that indicates its status:

To cycle through the fields within an instruction (and back to the instruction keyword) use Tab (forwards) or Shift+Tab (backwards).

A field open for editing has the text cursor initially at the right hand end: you move around it using left and right cursor keys in the usual way.

Click on:

To select an instruction (single or compound) click on its keyword.

If the current selection is a field press Tab until the whole instruction is selected.

If an instruction is already selected, then you can use:

where peer-level means at the same level of indentation and so within the same frame.


To move to selecting a different frame, use:

To select multiple consecutive instructions, let name be "Alice" print name

To delete one or more instructions (all at the same level), select either one instruction or a group of consecutive instructions,
then press Ctrl+d or Ctrl+Delete, or cut them to the clipboard with Ctrl+x.

To move one or more instructions, select them and cut them to the clipboard with Ctrl+x then, at a new code prompt, paste them in with Ctrl+v.

Click the new code prompt to change it to the prompt of valid keywords in the context.

If none is visible, select an instruction (or frame) and press Enter to insert new code below it.

If you wish to remove all new code prompts, press Alt+t or use the menu item trim.

To make the logical structure of your program, or parts of it, more easily seen, you may collapse any Global instruction (e.g. main, function) and any compound statement by selecting it and then double-clicking on its initial keyword. The instruction will now be displayed only as a white on green plus sign to the left of its first line:

+main

You restore the instruction by double clicking on the plus sign.


Go to the top