ex.hlp (Topic list)
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.
SQR Function Example
                        Example                Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
' This example uses the SQR function to plot the graph of y = SQR(ABS(x))
' for -9 <= x <= 9.
 
' 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
 SCREEN 1: COLOR 1            ' Low-resolution color graphics mode
 WINDOW (-9, -.25)-(9, 3.25)  ' Convert screen to Cartesian coordinates
 LINE (-9, 0)-(9, 0)          ' Draw X-axis
 LINE (0, -.25)-(0, 3.25)     ' Draw Y-axis
 FOR X = -9 TO 9
     LINE (X, .04)-(X, -.04)  ' Put tick marks on X-axis
 NEXT X
 FOR Y = .25 TO 3.25 STEP .25
     LINE (-.08, Y)-(.12, Y)  ' Put tick marks on Y-axis
 NEXT Y
 PSET (-9, 3)                 ' Plot the first point of function
 FOR X = -9 TO 9 STEP .25
     Y = SQR(ABS(X))          ' SQR argument cannot be negative
     LINE -(X, Y), 2          ' Draw a line to the next point
 NEXT X