# echo

## Purpose

Echo M-files during execution.

## Synopsis

    echo on
    echo off
    echo
    echo fcnname on
    echo fcnname off
    echo fcnname
    echo on all
    echo off all

## Description

`echo` controls the echoing of M-files during execution. Normally, the commands in M-files do not display on the screen during execution. Command echoing can be enabled for debugging, or for demonstrations, allowing the commands to be viewed as they execute.

`echo` behaves slightly differently, depending on whether a script file or a function file is being considered. For script files, the use of `echo` is simple; echoing can be either `on` or `off`, in which case any script used is affected:

- `echo` `on` turns on the echoing of commands in all script files.
- `echo` `off` turns off the echoing of commands in all script files.
- `echo`, by itself, toggles the echo state.
  With function files, the use of `echo` is more complicated. If `echo` is enabled on a function file, the file is interpreted, rather than compiled, so that each input line can be viewed as it is executed. Since this results in inefficient execution, use `echo` only for debugging.

- `echo` `fcnname` `on` turns on echoing of the named function file.
- `echo` `fcnname` `off` turns off echoing of the named function file.
- `echo` `fcnname` toggles the echo state of the named function file.
- `echo` `on` `all` and `echo` `off` `all` set echoing for all function files.

  (c) Copyright 1994 by The MathWorks, Inc.