-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsimple02.html
More file actions
66 lines (56 loc) · 3.42 KB
/
simple02.html
File metadata and controls
66 lines (56 loc) · 3.42 KB
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
---
layout: base.html
title: Simple HTML - Giving the computer a program
---
<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>
<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>. I'll include the <code class="command">RUN</code> command at the end of some of the program listings to remind you to run your programs!</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>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>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 reset the computer using the emulator's System menu, and then start again.</p>
</aside>
<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="{{ base_uri }}/img/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 get rid of a program you enter the command <code class="command">NEW</code>. This wipes the program from the computer’s memory.</p>
<p>I'll include <code class="command">NEW</code> at the start of future programs to remind you to do this before you start a new program.</p>
</article>
</section>
<section>
<article class="solo">
<footer>
<a href="{{ base_uri }}/simple03" class="button">Next</a>
</footer>
</article>
</section>