Writing a set of names in the declaration section should be grouped by type. Defining the name of a constant also gives a constant value. Defining the name of the function or procedure as well by defining the specification and its parameters.
The following is a common form of declaration section:
Declaration:
{Variable type name that is not the base data type}
Type of time: <hh: mm: ss: integer> {Time type consists of 3 input data "hh" as hour, "mm" as minute, and "ss" as second}
{Constant name, must specify data type and value}
Constant PHI: real = 3.14159265389793
Constant E: real = 2.718281828459045
{Name of variable using basic data type}
Name: String {a value that is a character set}
Found: boolean {a logical value (true or false)}
Weight: real {a fractional value}
NumberofChildren: integer {an integer value}
{Function name, defines domain, name, number, type and parameter, and output data type}
additional function (x: int, y: int): int
{process: add two data values and addition result as output value of function}
{Variable type name that is not the base data type}
Type of time: <hh: mm: ss: integer> {Time type consists of 3 input data "hh" as hour, "mm" as minute, and "ss" as second}
{Constant name, must specify data type and value}
Constant PHI: real = 3.14159265389793
Constant E: real = 2.718281828459045
{Name of variable using basic data type}
Name: String {a value that is a character set}
Found: boolean {a logical value (true or false)}
Weight: real {a fractional value}
NumberofChildren: integer {an integer value}
{Function name, defines domain, name, number, type and parameter, and output data type}
additional function (x: int, y: int): int
{process: add two data values and addition result as output value of function}
The following is an example part of the algorithm declaration calculating the area of the circle:
Declaration:
radius = real {data type of fractional}
area = real {type of fractional data}
PHI = 3.14
radius = real {data type of fractional}
area = real {type of fractional data}
PHI = 3.14
Similarly this article.
Sorry if there is a wrong word.
The end of word wassalamualaikum wr. wb
Referensi :
- Ebook Logical and Algorithm
Jika ingin bertanya secara privat, Silahkan hubungi no 085709994443 dan untuk berkomentar silahkan klick link di bawah ini 👇