Information Technology Reference
In-Depth Information
As you can see, our operator is the plus sign. There will be operators for subtraction and
division as well as logical operators, which are used to make decisions in programs, when
we need them. We will get into these later.
Hence, we have variables, keywords, labels and operators. Variables can use any
letters of the alphabet, numbers as well as the hyphen. No other symbol will be allowed.
Each variable must begin with a letter and cannot start with a hyphen or number. The
following are all valid:
initial-balance
deposit
jxqrtk
x
x-1-y-2
Each of the following are invalid:
bank balance - it has a space or blank between the end of one word and the start
of the other and that is not allowed
3rd withdrawal - the first position is a number, which is not allowed
x - 1 - the spaces around the hyphen are not acceptable
in&out - the & symbol is not allowed in variables
As far as the size of the field, there will be no limit; but some considerations are
in order. If you use x for a variable, it will be valid, but it might be difficult to understand
what it represents. If it is to stand for monthly maintenance fee, why not use monthly-fee ?
For a due date you could use z but due-date will be more appropriate. It will be more
meaningful. Thus a rule to use will be to make the field name long enough to have
significance but don't forget you have to key it in, so don't make it too long either.
As far as keywords and operators go, the former by their very makeup should be
easy to figure out regarding what they do. Usually operators will be a single character. If
there is any doubt as to the meaning of either of these, refer to the index at the back of the
topic for a list and descriptions of keywords and operators.
Putting together variables, keywords, labels and operators will result in a phrase
or sentence, not unlike the English language. In our case though this will become a line of
our program. Note that there will be rules to follow for each line and so far there has been
a hint of some of these constraints. We shall get into more specifics later. Taking a group
of valid lines of code and assuming some rules are followed, the result will be a section or
paragraph of our program, just as we had for the English language. With more rules being
met, a certain group of paragraphs or sections put together will result in a computer
program, which parallels our chapter in English.
Finally putting a group of programs together with further considerations will
result in a user application. This is very similar to our novel or work of non-fiction in
English. We could proceed further by grouping a few applications together to give us a
computer system. This we saw as our library in English. Our concern in this work is
programming so we will concentrate on that aspect and only mention applications and
systems on occasion. You can see that P language and all it encompasses is very similar
to what is involved with English. There are many similarities.
Search WWH ::




Custom Search