Difference between revisions of "SPC"

From QB64 Wiki
Jump to navigation Jump to search
imported>Clippy
m
imported>Clippy
m
Line 7: Line 7:
  
 
{{PageDescription}}
 
{{PageDescription}}
* When used in a {{KW|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.
 
** If {{Parameter|count%}} is greater than the number of columns left in the current row, remaining space characters are printed on the next row.
 
** 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 {{KW|PRINT (file statement)|PRINT #}} statement,
+
* When used in a [[PRINT (file statement)|PRINT #]] statement,
 
** {{Parameter|count%}} is the number of space characters to output.
 
** {{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.
 
** If {{Parameter|count%}} is less than or equal to zero, the function has no effect.
  
  
{{PageExamples}}
+
''Example:'' Using SPC to space a text print.
 
{{CodeStart}}{{Cl|PRINT}} "123456789"
 
{{CodeStart}}{{Cl|PRINT}} "123456789"
 
{{Cl|PRINT}} "abc" ; {{Cl|SPC}}(3) ; "123"{{CodeEnd}}
 
{{Cl|PRINT}} "abc" ; {{Cl|SPC}}(3) ; "123"{{CodeEnd}}
Line 25: Line 25:
 
{{PageSeeAlso}}
 
{{PageSeeAlso}}
 
* [[PRINT]], [[PRINT (file statement)|PRINT #]]
 
* [[PRINT]], [[PRINT (file statement)|PRINT #]]
* [[LPRINT]], [[TAB]], [[SPACE$]]
+
* [[LPRINT]], [[STRING$]]
 +
* [[TAB]], [[SPACE$]]
  
  
 
{{PageNavigation}}
 
{{PageNavigation}}

Revision as of 22:43, 28 July 2012

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


Syntax

SPC(count%)


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.


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