Skip to content

Commit a2fee11

Browse files
authored
Update 796-string-space.markdown
1 parent 63d9b63 commit a2fee11

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed
Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
11
# SPACE
22

3-
> SPACE (n)
3+
> s = SPACE (n)
44
5-
Returns a string of n spaces.
5+
Returns a string of `n` spaces.
66

7+
### Example 1:
78

8-
~~~
9+
```
10+
print "A" + space(5) + "B" ' Output: A B
11+
```
912

13+
### Example 2: Insert string into a buffer
14+
15+
```
1016
' s is a string ("" or longer); l is length of buffer (0+);
1117
Def lset(s, l) = Left(s + Space(l), l) ' left justify text
1218
Def rset(s, l) = Right(Space(l) + s, l) ' right justify text
1319
Const buffer = 10 ' length of buffer
20+
1421
While True Do
1522
Color 7, 0: Cls
1623
Print "[ Using a buffer of "; buffer; " spaces ]"
@@ -25,7 +32,4 @@ While True Do
2532
Color 0, 7: Print rset(text, buffer);
2633
Pause
2734
Wend
28-
29-
~~~
30-
31-
35+
```

0 commit comments

Comments
 (0)