## Beginning Programming 4 - Glossary of Terms

### by Brad Moore

Newsletter Home | Beginning Programming 4 Home | Section One | Section Two | Section Three | Section Four | Glossary

#### Argument -

An argument is a parameter that a function or sub program is given to work with. Most functions require certain predefined data to act on. For instance the LEN statement requires a string to be passed to it. We call the string variable the argument for the LEN function, or using another term, it is the required parameter.

#### ASCII -

Pronounced "Ask-key" this stands for the American Standard Code for Information Interchange. It is a term that is used to describe the standard character set definition that all English (and many foreign language) computers use. Specifically ASCII says that the character 65 always is "A" and 66 always is "B" and so on. It actually defines the characters from 32 (a space) through 255. It also defines loosely the characters 1 through 31 which most are special unprintable characters. For instance a linefeed is character 10 and a carriage return is character 13. If you want to see all the printable characters, here is a quick and dirty program that will print them out for you:

    for x = 32 to 255
      print "[";str$(x);"] = ";chr$(x);"  ";
      if x > 32 and x/6 = int(x/6) then print
    next x

#### Alpha Characters -

These are a subset of the ASCII character set and make up all the letters from A to Z in both capital and lower case form. They do not contain any numerals or special characters like the equals sign or pound sign or any of these.

#### Cast -

Cast is actually a term I lifted from C programming. It means to force a variable type onto a variable other than the original variable type. Since Liberty Basic has only two variable types (string and numeric) there really is very little to casting. To force a string to be numeric we simply use the VAL() function. To force a number to be a string we use the STR$() function. Casting implies temporary change to the variable type. To temporarily cast a numeric, simple do not use an assignment, rather force the change once as part of another statement or function. For instance in this print statement we are casting "x" a numeric to be a string temporarily:

    notice "The value of x is: " + str$(x)

The numeric must be cast as a string to be concatenated to the string literal. It however does not change "x" to be a string, rather it remains a numeric. The same can be applied to strings being cast as numerics.

#### Concatenate -

To concatenate is to join to similar items together. In programming strings are generally concatenated and not added. Some languages actually have a concatenation operator like an ampersand, but in Liberty Basic we can be said to either add two strings together or to concatenate them, as Liberty Basic uses the addition operator "+". I prefer concatenate over adding as it is more descriptive.

#### Nested -

Nested and nesting is a term applied to loops, IF statements and other program flow control statements. To nest a loop is to put one loop inside of another loop. For instance the outer loop will cycle three times and the inner loop will cycle six times in the example below:

    for x = 1 to 3
       for y = 1 to 6
         print x * y
       next y
    next x

In this case the y loop is said to be nested inside the x loop. The y loop will actually execute three times completely, once for each time through the outer loop. The output will actually count from 1 to 18 because 3 times 6 equals 18.

Loops and other control statements can be nested nearly indefinitely (although anything after seven or eight levels of nesting becomes difficult to manage). It is important to respect the nesting order when nesting. In the case of the FOR NEXT statements above, the "next y" had to precede the "next x" statements for the code to work. Changing the order will cause a next without a for error. This is because the "next y" is matched with the "for y" statement that is on its level. We will cover more of these ideas in a later installment when we deal with more forms of flow control.

Newsletter Home | Beginning Programming 4 Home | Section One | Section Two | Section Three | Section Four | Glossary