SPC: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 3: Line 3:


{{PageSyntax}}
{{PageSyntax}}
::: '''SPC({{Parameter|count%}})'''
: '''SPC({{Parameter|count%}})'''




Line 10: Line 10:




''Usage:''
{{PageDescription}}
* When used in a [[PRINT]] statement,
* When used in a [[PRINT]] statement,
** {{Parameter|count%}} is the number of space characters to print, overwriting existing characters.
** {{Parameter|count%}} is the number of space characters to print, overwriting existing characters.
Line 19: Line 19:




{{PageExamples}}
''Example:'' Using SPC to space a text print.
''Example:'' Using SPC to space a text print.
{{CodeStart}}{{Cl|PRINT}} "123456789"
{{CodeStart}}{{Cl|PRINT}} "123456789"

Latest revision as of 01:09, 29 January 2023

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.


Description

  • 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.


Examples

Example: Using SPC to space a text print.

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


See also



Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link