home *** CD-ROM | disk | FTP | other *** search
- ddd00000ff00fe0080000a7f
- ^1VvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvV
-
- ^2 A M O S F O R B E G I N N E R S .
-
- ^2F R O M T H E A G E O F F I V E T O N I N E T Y - F I V E .
-
- ^1VvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvV
-
- ^6 We have decided to rename the Amos for Kids section from this issue
- ^6onwards. This is because:-
-
- ^7a) It seems that not many people actually read Amos For Kids as it
- ^7was for kids not adults.
-
- ^7b) There were suggestions in the questionnaire that there was a need
- ^7for a section to be dedicated to those with little or no programming
- ^7knowledge.
-
- ^6 Therefore we have decided to combine the two. You want tutorials
- ^6which explain the basics of Basic, well, you've had that in Amos for
- ^6Kids since Issue 1 without knowing it! So dig out your back issues
- ^6of TA and forget the title and read Amos for Kids. Perhaps you'll
- ^6find something useful!
-
- ^5 It would be pretty wasteful to have 2 sections that contain the same
- ^5articles but have different titles, wouldn't it?
-
- ^1VvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvV
-
- ^2 Instead of the usual tutorial this issue, we shall attempt to
- ^2explain some Basic/Amos commands in more user friendly English! This
- ^2is a suggestion which came in with the survey forms.
-
- ^1 We shall assume that the readers of this article know little or
- ^1nothing about Basic, so we'll try to explain things from that point
- ^1of view. So as not to offend anyone, if you have already learnt the
- ^1things explained here, skip through the article, if not read on.
-
- ^2 Let's take a look at VARIABLES and ARRAYS.
-
- ^1 The information you give to a computer is called DATA, if you want
- ^1your computer to store this data in its memory, you will have to give
- ^1it a label. The label is called a VARIABLE and when you want the
- ^1computer to do something with the stored Data, you refer to it by its
- ^1variable name. It is called a Variable because the data to which it
- ^1refers can change during the program.
-
- ^6 Numeric variables can only remember numbers, if you want to store
- ^6letters or words as well, then you will need to use a string
- ^6variable.
-
- ^1 You can use a word or a letter as a variable name, but be careful
- ^1not to use a word that starts with a Basic command name as this will
- ^1confuse the computer! A string variable name must be followed by a
- ^1`$' eg A$ or PEACH$.
-
- ^6 Variable names such as DATA$, RUN$, EDITOR$ or PROCEDURE$ would be
- ^6illegal as they are Amos commands. If you used `_'as the first
- ^6character, it would be allowable eg _DATA$.
-
- ^2 ARRAYS
-
- ^1 An array is a set of data items held together under one variable
- ^1name. You can imagine the variable as space in the computer's memory
- ^1with lots of compartments. Arrays can be one-dimensional, that is, a
- ^1single line of boxes, or two-dimensional and have several rows of
- ^1boxes. You refer to an item in a one-dimensioned array by the number
- ^1of the box it is in eg in the diagram below, A$(4) is PLUM.
-
- ^4 A$
- ^6 ______ ________ _____ ____ _____
- ^6 | ^21 ^6| ^6| ^22 ^6| ^6| ^23 ^6| ^6| ^24 ^6| ^6| ^25 ^6|
- ^6 |^4APPLE ^6| ^6| ^4BANANA ^6| ^6|^4PEACH^6| ^6|^4PLUM^6| ^6|^4PEAR ^6|
- ^6 | | | | | | | | | |
- ^6 ------ -------- ----- ---- -----
-
- ^1For two-dimensioned arrays you have to give the number of the row and
- ^1the column eg D(3,2) is 15.
-
- ^4 D
- ^1 1 2 3
- ^6 __________________________
- ^6 | | | |
- ^4 1 ^6| ^25 ^6| ^212 ^6| ^216 ^6|
- ^6 |________|________|________|
- ^6 | | | |
- ^4 2 ^6| ^23 ^6| ^22 ^6| ^27 ^6|
- ^6 |________|________|________|
- ^6 | | | |
- ^4 3 ^6| ^28 ^6| ^215 ^6| ^211 ^6|
- ^6 |________|________|________|
- ^6 | | | |
- ^4 4 ^6| ^24 ^6| ^21 ^6| ^27 ^6|
- ^6 |________|________|________|
-
- ^1 Before you use an array you will have to tell the computer how big
- ^1it will be using the word DIM (short for dimension). In the above
- ^1example, you would use DIM D(4,3) (4 rows, 3 columns). For the first
- ^1example, you would use DIMA$(5). (It has 5 elements).
-
- ^4 The DIM statement should be at the beginning of the program as it
- ^4must only be used once.
-
- ^1 Arrays are a useful way of storing data. An array is a set of data
- ^1items held together under one variable name. Each item in an array
- ^1is called an element and the number of its position in the array is
- ^1called its subscript.
-
- ^7 Numeric Arrays
- ^4 Variable name- N
- ^7 These numbers are the subscripts
- ^7 |
- ^2 1 2 3 4 5 6
- ^4These are the elements- ^61066 1216 1485 1603 1665 1959
-
- ^1 Here is a numeric array called N. It contains 6 elements. You need
- ^1to tell the computer how big an array will be so that it can put
- ^1aside enough space in its memory. To do this you use the word DIM
- ^1followed by the array name and the number of elements it contains.
- ^1This is called dimensioning an array.
-
- ^4 DIM N(6)
-
- ^1 Numeric variables can only remember and store numbers.
-
- ^4 String Arrays
- ^2 1 2 3 4 5
- ^4 LEN ANNE MELANIE BEN PIPPA
-
- ^1 This is a string array, we'll call it TUCKER$ as it contains the
- ^1names of our family and it would then be easy to remember if it was
- ^1needed in a program!
- ^1 It contains 5 elements, so you would use DIM TUCKER$(5).
-
- ^4 They are handled in the same way as numeric arrays, but can
- ^4remember and store words or letters as well as numbers.
-
- ^2 This has been written by a non programmer with the aid of `The
- ^2Beginner's programming Handbook' by Usbourne Books. It's an old book,
- ^2and deals with Basic in general. The theory is if I can understand
- ^2what I'm writing, then anyone reading this might stand a chance!
- ^3 Anne.
-
- ^1VvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvVvV
- \
-
-