# Special variables -- $X

## $X

Introduced in the 1977 ANSI M[UMPS] language standard.

Note: the value **$X** is an approximation of the current
location of the horizontal position of the cursor on the current
I/O device. There are many examples where the value of **$X**
deviates significantly from the actual horizontal position of the
cursor. This is a problem that is somewhat relieved by an
addition in the 1995 standard.

`> `**FOR** I=1:1:50 **WRITE** I,"__" **IF**
**$X**>20 **WRITE** !

1__2__3__4__5__6__7__

8__9__10__11__12__13__

14__15__16__17__18__19__

20__21__22__23__24__25__

26__27__28__29__30__31__

32__33__34__35__36__37__

38__39__40__

The value of **$X** is defined to be an approximation of the
horizontal cursor coordinate, and the standard provides no
guarantees about the accuracy of this approximation.

Addition in the 1995 ANSI M[UMPS] language standard.

This standard allows the value of **$X** to be re-defined in a
**SET** command, so that, in case the value of **$X** lost
synchronization with the actual value of the cursor, the
programmer can correct the value of **$X**.

If the cursor is positioned using any of the functions from the
ANSI X3.64 standard, the standard defines that the value of
**$X** will be updated accurately.

Approved for addition in a future ANSI M[UMPS] Language Standard.
The initial value of **$X** is implementation-dependent.
However, if the initial value of **$IO** is the empty string,
then the initial value of **$X** is 0 (zero).

This document is © Ed de Moel, 1995-2005.

It is part of a book by Ed de Moel that is published under the
title "M[UMPS] by Example" (ISBN 0-918118-42-5).

Printed copies of the book are no longer available.

This document describes the various special variables that are
defined in the M[UMPS] language standard (ANSI X11.1, ISO
11756).

*The information in this document is NOT authoritative
and subject to be modified at any moment.*

Please consult the appropriate (draft) language standard for an
authoritative definition.

*In this document, information is included that will
appear in
future standards.*

The MDC cannot guarantee that these 'next'
standards will indeed appear.