> ## Documentation Index
> Fetch the complete documentation index at: https://docs.riza.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Output

> Getting output from your script

Your script has access to `stdout` and `stderr` for writing output. The API also
returns the program's exit code.

## Write to `stdout`

The [execute code](/api-reference/command/execute-code) endpoint returns anything
your script writes to `stdout` as the value of the `stdout` parameter.

## Write to `stderr`

The [execute code](/api-reference/command/execute-code) endpoint returns anything
your script writes to `stderr` as the value of the `stderr` parameter.

<RequestExample>
  ```js Node theme={null}
  import Riza from '@riza-io/api';

  const pythonCode = `
  import sys
  print("Writing to stdout")
  print("Writing to stderr", file=sys.stderr)
  `;

  const riza = new Riza();

  async function main() {
    const resp = await riza.command.exec({
      language: "python",
      code: pythonCode,
    });
    console.log(resp);
  }

  main();
  ```

  ```py Python theme={null}
  from rizaio import Riza

  CODE = """
  import sys
  print("Writing to stdout")
  print("Writing to stderr", file=sys.stderr)
  """

  client = Riza()

  resp = client.command.exec(
      language="python",
      code=CODE,
  )

  print(dict(resp))
  ```

  ```go Go theme={null}
  package main

  import (
      "context"
      "log"
      "log/slog"

      "github.com/riza-io/riza-api-go"
  )

  const pythonCode = `
  import sys
  print("Writing to stdout")
  print("Writing to stderr", file=sys.stderr)
  `

  func main() {
      client := riza.NewClient()
      params := riza.CommandExecParams{
          Language: riza.F(riza.CommandExecParamsLanguagePython),
          Code:     riza.F(pythonCode),
      }
      resp, err := client.Command.Exec(context.Background(), params)
      if err != nil {
          log.Fatal(err)
      }
      slog.Info(
          resp.Stdout, 
          "code", resp.ExitCode,
          "stderr", resp.Stderr,
      )
  }
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
      "exit_code": 0,
      "stdout": "Writing to stdout",
      "stderr": "Writing to stderr",
  }
  ```
</ResponseExample>
