Skip to main content

Continuation prompt?

rascal-0.40.17
Synopsis

What is the continuation prompt >>>>>>?

Description

When Rascal can not recognize a complete command yet, it will prompt with this >>>>>>:

rascal>x = 1
>>>>>>>

The reason is that it expects a ; after every Assignment. To cancel the entire command, provide an empty line:

rascal>

But we could also finish the command:

rascal>x = 1
>>>>>>>;
int: 1

Benefits

For typing more complex structured commands it is easy to split up a statement over several lines:

rascal>import IO;
ok
rascal>for (int i <- [0..11]) {
>>>>>>> println("Counting <i>");
>>>>>>>}
Counting 0
Counting 1
Counting 2
Counting 3
Counting 4
Counting 5
Counting 6
Counting 7
Counting 8
Counting 9
Counting 10
list[void]: []

As you can see the entire For loop only starts when the prompt recognizes the entire command.

Pitfalls

  • If you type an empty line in the middle of a complex command, it is cancelled:
rascal>import IO;
ok
rascal>for (int i <- [0..11]) {
>>>>>>>
rascal>
  • When copy/pasting code from an editor into the shell, frequently empty lines occur that trigger the cancellation behavior.