
procedures, not returning a value (and rather effectuating some impact to the environment). Depending on whether subroutines return a value or not, they are usually subdivided into And you should decompose an algrithm that grows too large to keep the overview (structogams are not meant to rise to the size of a soccer field!). Then you will usually find it helpful to define your own subroutines, in particular if you have to perform them several times with differing parameter values. the rotation of the turtle by some degrees in Turtleizer), more complex subtasks may arise on decomposing an algorithmic problem. Whereas subroutines like calculating the sine of an angle or the square root of a number are already built in (as is e.g. On the other hand, they possibly return a result value to the calling level. Subroutines usually cannot access variables outside their scope but are provided with the values they need via parameters (on calling). Or you might want to draw a certain figure with the turtle several times at different places in the Turtleizer tool. to calculate the area of a circle with given radius, the volume of a cuboid, or the average (mean value) of a given list of numbers. A subroutine typically means a parameterised algorithm that can be used to perform some subordinate task within a program or another routine, e.g.
It usually communicates with the user via input and output instructions. A program or main means a standalone algorithm (an application) as being executable as a process on the operating system level.The framing (or root) element of a Nassi-Shneiderman diagram represents either a program, a (callable) subroutine, or an includable diagram (also see Type setting). Ideally, the algorithm name should start with a letter and contain only letters, digits and underscores (identifier syntax).Īlso make sure to fill in the lower text field (superscribed " Comment") with a description of what the algorithm is good for and how to use it.If the name is to consist of several words, you may fill the gaps between the words with underscores: THE_ALGORITHM_NAME_SHOULD_BE_CONTIGUOUS.The name should not contain spaces: THIS IS NOT A GOOD ALGORITHM NAME.The name should be an "identifier", i.e.:.The name should represent the aim of your algorithm.
When you start Structorizer or create a new diagram (via button or key ), then you will be presented an empty diagram with dummy name "?" (the red triangle just flags the related Analyser hint in the bottom report list):ĭouble-click the question marks and fill in a sensible name in the upper text field superscribed with " Diagram name / function signature" of the element editor that will pop up.