Monday, October 6, 2014

Another part of the puzzle.



In an earlier article we briefly discussed the start, stop, and flow symbols. Now let us add one more symbol. Now let's add the rectangle to represent process or arithmetic calculation. Computers have memory. We can represent a piece of memory with a symbol known as a variable. Variables can change value at any time we want them to. Usually when we change a variable, we assign a new value to it or we just want to define a part of memory to a particular variable.




In this case, we want define part of memory to be known as "A" and then assign the value of zero to it. We could also say that "A" was assigned a starting value of zero sort of like algebra you may have learned in school. So the program above starts, then assigns the value of zero to "A", and then just stops  So far that does not seem very practical, but it is still a program.

So now so far, we have four tools to work with. Let's review. Every program must have a starting and an ending point or termination. We need to have flowlines to describe how the program gets from the beginning to the end. Now we have a way to define a process or something to do in the program we have just created. This program might be represented in code as (rem stands for remarks or programmer notes that will not be executed by the computer):

'rem start
A=0
end

or

'rem start
'rem assign values
let A = 0
'rem stop
end

or you could go a bit further for documentation purposes:

'****************************************
'  Program start
'
'=========================
'Variable assigment (aka starting values)
'
Let A = 0
'
'=========================
'  Program stop (this is the end of the program)
end
'
'****************************************

No comments:

Post a Comment