Space: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
Brendon (talk | contribs)
No edit summary
JwellsNB (talk | contribs)
Add javascript snippet
Line 5: Line 5:
Space returns a string consisting of a number of spaces. The required argument, ''number'', is any valid numeric expression.
Space returns a string consisting of a number of spaces. The required argument, ''number'', is any valid numeric expression.


== Example ==
== Example (Basic) ==


<pre>
<pre>
Line 15: Line 15:
   Letter = Left(Spaces, i) & CHR(65 + i)
   Letter = Left(Spaces, i) & CHR(65 + i)
   Print Letter
   Print Letter
Next
</pre>
== Example (JavaScript) ==
<pre>
// Space Example
/* Space creates a string of spaces */
var Spaces, Letter;
Spaces = new Array(4 + 1).join(" ");
for(i = 0; i <= 4; i++) {
  Letter = Spaces.substring(0,i)  +  CHR(65 + i));
  NSB.Print((Letter));
}
</pre>
</pre>



Revision as of 22:52, 19 May 2013

Space(number)

Description

Space returns a string consisting of a number of spaces. The required argument, number, is any valid numeric expression.

Example (Basic)

Rem Space Example
'Space creates a string of spaces
Dim Spaces, Letter
Spaces = Space(4)
For i = 0 to 4
  Letter = Left(Spaces, i) & CHR(65 + i)
  Print Letter
Next

Example (JavaScript)

// Space Example
/* Space creates a string of spaces */

var Spaces, Letter;
Spaces = new Array(4 + 1).join(" ");
for(i = 0; i <= 4; i++) {
  Letter = Spaces.substring(0,i)  +  CHR(65 + i));
  NSB.Print((Letter));
}

Output

A
 B
  C
   D
    E

Related Items

String