{{htmlmetatags>metatag-robots=() metatag-title=(AT | ugBASIC User Manual) metatag-keywords=(ugBASIC,Commodore 64,Commodore PLUS/4,ZX Spectrum) metatag-description=(Manual page for AT) metatag-media-og:image=(:ugbasic:logo-ugbasic-fb.png) metatag-og:title=(AT | ugBASIC User Manual) metatag-og:description=(Manual page for AT) }} ====== 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: * ''[[https://github.com/spotlessmind1975/ugbasic/tree/main/examples/texts_position_05.bas|texts_position_05.bas]]'' * ''[[https://github.com/spotlessmind1975/ugbasic/tree/main/examples/texts_position_06.bas|texts_position_06.bas]]'' ==== ABBREVIATION ==== At ==== AVAILABLE ON ==== ==== SEE ALSO ==== [[LOCATE]] [[SWAP]] ==== ANY PROBLEM? ==== If you have encountered a problem using this command, if you think there is a bug or the explanation is unclear, please [[https://github.com/spotlessmind1975/ugbasic/issues/new?title=ISSUE ON AT|open an issue]] for this keyword on GitHub. Thank you!===== POWERED BY ===== [[:ugbasic:user:index|{{ :ugbasic:user:logo-ugbasic.png?nolink&600 |}}]]