Debian Codegraph @

examples/prism-basic.html

raw symbols SCIP
1 <p>Note: this component focuses on first and second-generation BASICs (such as MSX BASIC, GW-BASIC, SuperBASIC, QuickBASIC, PowerBASIC...).</p>
2
3 <h2>Comments</h2>
4 <pre><code>! This is a comment
5 REM This is a remark</code></pre>
6
7 <h2>Strings</h2>
8 <pre><code>"This a string."
9 "This is a string with ""quotes"" in it."</code></pre>
10
11 <h2>Numbers</h2>
12 <pre><code>42
13 3.14159
14 -42
15 -3.14159
16 .5
17 10.
18 2E10
19 4.2E-14
20 -3E+2</code></pre>
21
22 <h2>Dartmouth Basic example</h2>
23 <pre><code>5 LET S = 0
24 10 MAT INPUT V
25 20 LET N = NUM
26 30 IF N = 0 THEN 99
27 40 FOR I = 1 TO N
28 45 LET S = S + V(I)
29 50 NEXT I
30 60 PRINT S/N
31 70 GO TO 5
32 99 END</code></pre>
33
34 <h2>GW-BASIC example</h2>
35 <pre><code>10 INPUT "What is your name: ", U$
36 20 PRINT "Hello "; U$
37 30 INPUT "How many stars do you want: ", N
38 40 S$ = ""
39 50 FOR I = 1 TO N
40 60 S$ = S$ + "*"
41 70 NEXT I
42 80 PRINT S$
43 90 INPUT "Do you want more stars? ", A$
44 100 IF LEN(A$) = 0 THEN GOTO 90
45 110 A$ = LEFT$(A$, 1)
46 120 IF A$ = "Y" OR A$ = "y" THEN GOTO 30
47 130 PRINT "Goodbye "; U$
48 140 END</code></pre>
49
50 <h2>QuickBASIC example</h2>
51 <pre><code>DECLARE SUB PrintSomeStars (StarCount!)
52 REM QuickBASIC example
53 INPUT "What is your name: ", UserName$
54 PRINT "Hello "; UserName$
55 DO
56 INPUT "How many stars do you want: ", NumStars
57 CALL PrintSomeStars(NumStars)
58 DO
59 INPUT "Do you want more stars? ", Answer$
60 LOOP UNTIL Answer$ &lt;> ""
61 Answer$ = LEFT$(Answer$, 1)
62 LOOP WHILE UCASE$(Answer$) = "Y"
63 PRINT "Goodbye "; UserName$
64
65 SUB PrintSomeStars (StarCount)
66 REM This procedure uses a local variable called Stars$
67 Stars$ = STRING$(StarCount, "*")
68 PRINT Stars$
69 END SUB</code></pre>