Difference between revisions of "SPC"

From QB64 Wiki
Jump to navigation Jump to search
imported>Clippy
(Created page with 'The '''SPC''' function moves the PRINT cursor a number of horizontal or column places. ''Syntax:'' SPC(columns) * The columns value tells the cursor how many spaces to m…')
 
m (Text replacement - "{{Parameters}}" to "{{PageParameters}}")
 
(10 intermediate revisions by 2 users not shown)
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 [[PRINT]] and [[LPRINT]] statements to print or output a number of space characters.
  
  
 +
{{PageSyntax}}
 +
::: '''SPC({{Parameter|count%}})'''
  
''Syntax:'' SPC(columns)
 
  
 +
{{PageParameters}}
 +
* ''count'' designates the number of column spaces to move the cursor in a [[PRINT]] statement.
  
* 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$]].
 
  
 +
''Usage:''
 +
* When used in a [[PRINT]] statement,
 +
** {{Parameter|count%}} is the number of space characters to print, overwriting existing characters.
 +
** If {{Parameter|count%}} is greater than the number of columns left in the current row, remaining space characters are printed on the next row.
 +
* When used in a [[PRINT (file statement)|PRINT #]] statement,
 +
** {{Parameter|count%}} is the number of space characters to output.
 +
** If {{Parameter|count%}} is less than or equal to zero, the function has no effect.
  
  
''See also:'' [[CSRLIN]], [[POS]]
+
''Example:'' Using SPC to space a text print.
 +
{{CodeStart}}{{Cl|PRINT}} "123456789"
 +
{{Cl|PRINT}} "abc" ; {{Cl|SPC}}(3) ; "123"{{CodeEnd}}
 +
{{OutputStart}}123456789
 +
abc  123
 +
{{OutputEnd}}
  
  
 +
{{PageSeeAlso}}
 +
* [[PRINT]], [[PRINT (file statement)|PRINT #]]
 +
* [[LPRINT]], [[STRING$]]
 +
* [[TAB]], [[SPACE$]]
  
==Navigation:==
 
  
[[Keyword_Reference_-_Alphabetical|Go to Keyword Reference - Alphabetical]]
+
{{PageNavigation}}
 
 
[[Keyword Reference - By usage|Go to Keyword Reference - By usage]]
 

Latest revision as of 12:40, 17 February 2021

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


Syntax

SPC(count%)


Parameters

  • count designates the number of column spaces to move the cursor in a PRINT statement.


Usage:

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


Example: Using SPC to space a text print.

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

123456789 abc 123


See also



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