# marmot repl (/docs/commands/repl)

<!-- Generated by scripts/gen.mjs from `marmot repl --help` and scripts/commands.mjs. Do not edit by hand. -->

Read Go declarations, statements and expressions and run them as you type, on the incremental build. Expressions print their value; imports of the standard library are added when you use a package. Tab or the right arrow accepts the completion shown in grey. Commands: :type EXPR, :doc NAME, :time, :imports, :reset, :quit.

```text title="Usage"
marmot repl [flags]
```

## Examples [#examples]

```sh
marmot repl
echo 'strings.Repeat("ab", 3)' | marmot repl
```

`marmot repl` reads Go one entry at a time. An expression prints its value, a statement runs, a
`func` or `type` declaration is kept for later entries. Packages of the standard library are
imported when you use them (`strings.ToUpper("a")` just works); `import "example.com/x"` adds
others. History is kept in `~/.marmot_history`.

| Command | What it does |
| --- | --- |
| `:type EXPR` | Print the type of an expression. |
| `:doc NAME` | Print the documentation of a name. |
| `:time` | Time each entry. |
| `:imports` | List the imports in effect. |
| `:reset` | Forget every entry. |
| `:quit` | Leave. |

Each entry is compiled and run as a whole program with the entries before it, and only the new
output is shown. Earlier statements run again each time, so their side effects repeat. An entry
that does not compile or panics is not kept.

## Flags [#flags]

Flags take one dash or two: `-release` and `--release` are the same.

| Flag | Meaning |
| --- | --- |
| `-time` | print how long each entry took to build and run |

## Full help [#full-help]

```text title="marmot repl --help"
Read Go declarations, statements and expressions and run them as you type, on the incremental build. Expressions print their value; imports of the standard library are added when you use a package. Tab or the right arrow accepts the completion shown in grey. Commands: :type EXPR, :doc NAME, :time, :imports, :reset, :quit.

Usage:
  marmot repl [flags]

Examples:
marmot repl
echo 'strings.Repeat("ab", 3)' | marmot repl

Flags:
  -h, --help   help for repl
      --time   print how long each entry took to build and run
```