Big Exit

Most sensible programming languages, and plenty of other applications, have an REPL, or read-eval-print loop. They’re a good way of trying out simple commands, running scripts and so on. The trouble is, I can never remember how to leave the damn things, because they all have different ways of issuing the quit command.

Language designers like ‘Quit’ to be a command or procedure in the language itself; something syntactically and semantically correct that wouldn’t be out of place in a file of source code written in that language. In principle this is exactly right; in practice, it means every REPL implements ‘Quit’ differently, and as soon as you use more than three or four, they become harder and harder to remember. Here are a few I use fairly often.

Ruby (IRB)

> exit

In this context, exit just looks like a keyword, but it’s actually a method on the main object. If you call self.exit at the IRB prompt it’ll have the same effect.

JavaScript (Rhino)

> quit();

A function call; entering quit without the parentheses will just return the function, not call it.

Scheme (mzscheme)

> (exit)

Parentheses required, of course, since Scheme is a Lisp and exit is a procedure.

Haskell (GHCi)

> :quit

This one’s a command, as opposed to a statement in the language (Haskell is an essentially declarative language, and thus involves making statements rather than calling commands). There are a lot of useful commands in GHCi; type :? and it’ll list them for you.

MySQL

> \q
> quit
> \quit
> exit
> \exit

These all work. There might be more.

SQLite

> .exit

The dot prefix distinguishes SQLite commands from SQL queries.

, , , , , , , ,