Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
STRING$ Function Example
◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
' This example uses the STRING$ function to generate a bar graph.
' To try this example:
' 1. Choose New Project from the File menu
' 2. Copy the code example below to the code window
' 3. Press F5 to run the example
CLS ' Clear the screen
PRINT TAB(7); "Daily Mean Temperature in Seattle"
PRINT
FOR MMonth = 1 TO 12 STEP 2 ' Get data for each month and graph
READ Month$, Temp
PRINT Month$; " +"; STRING$(Temp - 35, "*") ' Print Temp-35 stars
PRINT " |"
NEXT MMonth
PRINT " +"; ' Print horizontal line
FOR X = 1 TO 7
PRINT "----+";
NEXT X
PRINT
FOR X = 4 TO 39 STEP 5 ' Print temperature labels
PRINT TAB(X); X + 31;
NEXT X
PRINT
DATA Jan, 40, Mar, 46, May, 56
DATA Jul, 66, Sep, 61, Nov, 46