# Show a constant

Put the value of a constant in a sentence, so that the sentence stays true.

<!-- site:editor -->

<!-- docgen:code file=internal/cli/testdata/repo/v2/machine/machine.go symbol=DefaultWait -->

``` go
const DefaultWait = 250 * time.Millisecond
```

<!-- /docgen:code -->

<!-- docgen:docgen root=internal/cli/testdata/repo module=v2 page=docs/machines/guide-const.md -->

#### Before

    The default wait is <!-- docgen:const pkg=machine name=DefaultWait --><!-- /docgen:const -->.

#### After

    The default wait is <!-- docgen:const pkg=machine name=DefaultWait -->`250ms`<!-- /docgen:const -->.

<!-- /docgen:docgen -->

<!-- /site:editor -->

A value prints as Go prints it, so a `time.Duration` is `250ms`, and a type with a `String` method prints its text.

Use `print=` to choose another form:

<!-- site:editor -->

<!-- docgen:code file=internal/cli/testdata/repo/v2/machine/port.go -->

``` go
package machine

import "fmt"

// Port is a network port.
type Port uint16

// String returns the port as text.
func (p Port) String() string { return fmt.Sprintf("port %d", uint16(p)) }

// PortWeb is the port of the web server.
const PortWeb Port = 8080

// Listen is the port of a new Lamp.
var Listen = PortWeb
```

<!-- /docgen:code -->

<!-- docgen:docgen root=internal/cli/testdata/repo module=v2 page=docs/machines/guide-const-print.md -->

#### Before

    - Default: <!-- docgen:const pkg=machine name=Listen --><!-- /docgen:const -->
    - `go`: <!-- docgen:const pkg=machine name=Listen print=go --><!-- /docgen:const -->
    - `raw`: <!-- docgen:const pkg=machine name=Listen print=raw --><!-- /docgen:const -->
    - `name`: <!-- docgen:const pkg=machine name=Listen print=name --><!-- /docgen:const -->
    - `%06d`: <!-- docgen:const pkg=machine name=Listen print=%06d --><!-- /docgen:const -->

#### After

    - Default: <!-- docgen:const pkg=machine name=Listen -->`port 8080`<!-- /docgen:const -->
    - `go`: <!-- docgen:const pkg=machine name=Listen print=go -->`port 8080`<!-- /docgen:const -->
    - `raw`: <!-- docgen:const pkg=machine name=Listen print=raw -->`8080`<!-- /docgen:const -->
    - `name`: <!-- docgen:const pkg=machine name=Listen print=name -->`PortWeb`<!-- /docgen:const -->
    - `%06d`: <!-- docgen:const pkg=machine name=Listen print=%06d -->`008080`<!-- /docgen:const -->

<!-- /docgen:docgen -->

<!-- /site:editor -->

With `code=false`, the value has no backticks, such as 250ms.

For all options, see [`docgen:const`](../reference/markers.md#docgenconst).
