kristofer 修订了这个 Gist . 跳至此修订
1 file changed, 28 insertions
basic1.bas(file created)
@@ -0,0 +1,28 @@ | |||
1 | + | 10 PRINT "Top 10 BASIC Features" | |
2 | + | 20 PRINT "1. PRINT - Displays output on the screen" | |
3 | + | 30 PRINT "2. LET - Assigns values to variables" | |
4 | + | 40 LET myVar = 5 | |
5 | + | 50 PRINT "3. INPUT - Gets user input" | |
6 | + | 60 INPUT "Enter your name"; name$ | |
7 | + | 70 PRINT "Hello ";name$ | |
8 | + | 80 PRINT "4. IF/THEN - Makes decisions" | |
9 | + | 90 INPUT "Enter a number"; num | |
10 | + | 100 IF num > 5 THEN PRINT "The number is greater than 5" | |
11 | + | 110 PRINT "5. FOR/NEXT - Loops" | |
12 | + | 120 FOR i = 1 TO 5 | |
13 | + | 130 PRINT i | |
14 | + | 140 NEXT | |
15 | + | 150 PRINT "6. FUNCTIONS" | |
16 | + | 160 PRINT SQR(4) | |
17 | + | 170 PRINT "7. COMMENTS - Notes in code" | |
18 | + | 180 ' This prints hello | |
19 | + | 190 PRINT "Hello" | |
20 | + | 200 PRINT "8. STRINGS" | |
21 | + | 210 PRINT "My string"; "abc" | |
22 | + | 220 PRINT "9. ARRAYS - Store lists of data" | |
23 | + | 230 DIM scores(5) | |
24 | + | 240 scores(0) = 5 | |
25 | + | 250 PRINT scores(0) | |
26 | + | 260 PRINT "10. RANDOMIZE/RND - Generate random numbers" | |
27 | + | 270 RANDOMIZE TIMER | |
28 | + | 280 PRINT RND |
更新
更早