Previous Topic: Move the CursorNext Topic: Set the Cursor Position


Move Cursor Up, Down, Left, and Right

You can move the cursor in any direction using directional commands. Note that each of these commands requires an operand indicating the number of rows or columns the cursor is to be moved.

Moving the Cursor Up

To move the cursor up a specified number of rows (lines), use the UP command. For example, the following statement moves the cursor up five lines:

UP 5

The UP command simulates pressing the up-arrow key. If the cursor reaches the top of the screen, it wraps to the bottom and continues upward from there.

Moving the Cursor Down

To move the cursor down a specified number of rows (lines), use the DOWN command. For example, the following statement moves the cursor down five lines:

DOWN 5

The DOWN command simulates pressing the down-arrow key. If the cursor reaches the bottom of the screen, it wraps to the top and continues downward from there.

Moving the Cursor Left

To move the cursor left a specified number of columns, use the LEFT command. For example, the following statement moves the cursor left five columns:

LEFT 5

The LEFT command simulates pressing the left-arrow key. If the cursor reaches the left side of the screen, it wraps to the right side and continues left from there.

Moving the Cursor Right

To move the cursor right a specified number of columns, use the RIGHT command. For example, the following statement moves the cursor right five columns:

RIGHT 5

The RIGHT command simulates pressing the right-arrow key. If the cursor reaches the right side of the screen, it wraps to the left side and continues right from there.