User Tools

Site Tools


ugbasic:user:kw:at
Translations of this page:


ugBASIC User Manual

AT ✓

SYNTAX

   = AT$( x , y )
   = AT( x , y )
   AT var1, var2

PURPOSE

The AT function is used to create a string to position the cursor to an exact position on the screen, when it will be printed on the screen. It's like telling a painter where to start painting on a canvas, not moving immediately but storing the command in a string.

The AT function is followed by two expressions, separated by a comma: x indicates the column in which move the cursor, while y will be the line in which to start writing.

The string that is returned takes the standard format. So whenever this string is printed, the text cursor will be moved to the text coordinates held by x and y.

The AT command is used to swap the values of two string variables. In practice, the reference of the first variable are assigned to the second and vice versa, in a single operation, and without memory movement. Infact, the AT command actually performs a similar operation at the machine level, but more efficiently and hidden from the programmer.

The AT command makes code more concise and readable by avoiding the use of a temporary variable for swapping. Using this command is a fundamental operation in many sorting algorithms with array of strings, such as bubble sort. In general, swapping strings is a common operation in many programs, and AT provides a simple and efficient way to do it. This command can only be used with variables of the type string.

EXAMPLE

  PRINT AT$(10,10); "at 10, 10"
  a$ = "primo" : b$ = "secondo"
  AT a$, b$
  PRINT a$, b$

See also the following example files:

ABBREVIATION

 At

AVAILABLE ON

SEE ALSO

ANY PROBLEM?

If you have encountered a problem using this command, if you think there is a bug or the explanation is unclear, please open an issue for this keyword on GitHub. Thank you!

POWERED BY