Difference between revisions of "SPC"

From QB64 Wiki
Jump to navigation Jump to search
imported>Clippy
m
imported>Stylin
(updated to new blueprint, modified according to discussion at http://www.qb64.net/forum/index.php?topic=801.0)
Line 1: Line 1:
The '''SPC''' function moves the [[PRINT]] cursor a number of horizontal or column places.
+
The {{KW|SPC}} function is used in {{KW|PRINT}} and {{KW|PRINT (file statement)|PRINT #}} statements to print or output a number of space characters.
  
  
 +
{{PageSyntax}}
 +
:<code>{{KW|SPC}}({{Parameter|n%}})</code>
  
::::::''Syntax:'' SPC(columns)
 
  
 +
{{PageDescription}}
 +
* When used in a {{KW|PRINT}} statement,
 +
** {{Parameter|n%}} is the number of space characters to print, overwriting existing characters.
 +
** If {{Parameter|n%}} is greater than the number of columns left in the current row, the remaining space characters are printed on the next row at column 1.
 +
* When used in a {{KW|PRINT (file statement)|PRINT #}} statement,
 +
** {{Parameter|n%}} is the number of space characters to output.
 +
* If {{Parameter|n%}} is less than or equal to zero, the function has no effect.
  
* The columns value tells the cursor how many spaces to move to the right.
 
* If there are not enough spaces on one row it moves down to the next row.
 
* Column values are not limited like the [[TAB]] function.
 
* SPC erases any previous text where the cursor was moved just like [[SPACE$]].
 
  
 +
{{PageExamples}}
 +
{{CodeStart}}{{Cl|PRINT}} "123456789"
 +
{{Cl|PRINT}} "abc" ; {{Cl|SPC}}(3) ; "123"{{CodeEnd}}
 +
{{OutputStart}}123456789
 +
abc  123
 +
{{OutputEnd}}
  
  
''See also:'' [[CSRLIN]], [[POS]]
+
{{PageSeeAlso}}
 +
* {{KW|PRINT}}, {{KW|PRINT (file statement)|PRINT #}}
 +
* {{KW|TAB}}
  
  
 
+
{{PageNavigation}}
==Navigation:==
 
 
 
[[Keyword_Reference_-_Alphabetical|Go to Keyword Reference - Alphabetical]]
 
 
 
[[Keyword Reference - By usage|Go to Keyword Reference - By usage]]
 

Revision as of 17:35, 11 March 2010

The SPC function is used in PRINT and PRINT # statements to print or output a number of space characters.


Syntax

SPC(n%)


Description

  • When used in a PRINT statement,
    • n% is the number of space characters to print, overwriting existing characters.
    • If n% is greater than the number of columns left in the current row, the remaining space characters are printed on the next row at column 1.
  • When used in a PRINT # statement,
    • n% is the number of space characters to output.
  • If n% is less than or equal to zero, the function has no effect.


Examples

PRINT "123456789" PRINT "abc" ; SPC(3) ; "123"

123456789 abc 123


See also



Navigation:
Keyword Reference - Alphabetical
Keyword Reference - By Usage
Main Wiki Page