forked from karlvr/learn-to-code-basic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimple02.html
74 lines (65 loc) · 3.53 KB
/
simple02.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<!doctype html>
<html>
<head>
<title>Simple BASIC</title>
<meta charset="utf-8">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300&display=swap" rel="stylesheet">
<link href="lesson.css" rel="stylesheet">
</head>
<body>
<section class="side-by-side">
<canvas class="game right" id="canvas" oncontextmenu="event.preventDefault()"></canvas>
<div>
<article>
<h1>Giving the computer a program</h1>
<p>We’re going to learn how to enter programs into this computer.</p>
<p>Let’s go!</p>
<p>Carefully type in the lines below, including the line numbers, pressing the RETURN key after typing each line:</p>
<pre>
10 PRINT "HELLO"
20 PRINT "WHAT'S YOUR NAME?"
30 INPUT N$
40 PRINT "HELLO "; N$</pre>
<aside>
<p>If the computer says <em>Syntax error</em> or anything strange happens, press the RETURN key, check that you’ve typed exactly what appears above including the line numbers.
You can always reload the page to reset the computer and start again.</p>
</aside>
<p>Each line starts with a line number. If you make a mistake on a line you can edit it using its line number. Enter <code class="command">EDIT 10</code> to edit line 10, then press the RETURN key to finish editing.</p>
<aside><p>When I say "enter" I mean type the command and then press the RETURN key to <em>enter</em> the command.</p></aside>
<p>When you’ve finished typing your program, enter <code class="command">LIST</code> to show your program. If you’ve made any mistakes, edit the line that contains the mistake. If you’ve added extra lines you can remove them using the <code class="command">DELETE</code>, for example enter <code class="command">DELETE 10</code> to delete line 10.</p>
<p>Run your program by entering <code class="command">RUN</code>.
<p>You can type program lines in any order you like. The computer always runs the lines in the numbered order. So if you’ve deleted line 10, or you want to replace it, you can simply type it in again.</p>
<p>To start your program over again, enter <code class="command">NEW</code>.</p>
</article>
</div>
</section>
<section>
<article class="solo">
<h2>Mistakes in programs</h2>
<p>If a program does not run properly, you have probably made a mistake in it. Even a
typing error can stop a program running. Mistakes
in programs are called bugs.</p>
<center><img src="usborne/simple-basic/img//03mistakes.jpg"></center>
<p>If a <em>Syntax error</em> occurs in your program you’ll automatically start editing the line with the mistake. Try fixing the line, press RETURN to finish editing, and <code class="command">RUN</code> your program again to see if you’ve fixed the bug.</p>
<p>You can always view your whole program by entering <code class="command">LIST</code>, and then <code class="command">EDIT #</code> or <code class="command">DELETE #</code> any line (replace <code>#</code> with the line number</code>).</p>
</article>
</section>
<section>
<article class="solo">
<h2>Getting rid of programs</h2>
<p>To getrid of a program you enter the command <code class="command">NEW</code>. This wipes the program from the computer’s memory.</p>
</article>
</section>
<section>
<article class="solo">
<footer>
<a href="simple03.html" class="button">Next</a>
</footer>
</article>
</section>
<script src="js/cpc.js"></script>
<script async type="text/javascript" src="https://floooh.github.io/tiny8bit/cpc.js"></script>
</body>
</html>