Presentation is loading. Please wait.

Presentation is loading. Please wait.

Higher Grade Computing Studies 3. High Level Language Constructs Higher Computing Software Development S. McCrossan 1 Simple Data Types Integer: An integer.

Similar presentations


Presentation on theme: "Higher Grade Computing Studies 3. High Level Language Constructs Higher Computing Software Development S. McCrossan 1 Simple Data Types Integer: An integer."— Presentation transcript:

1 Higher Grade Computing Studies 3. High Level Language Constructs Higher Computing Software Development S. McCrossan 1 Simple Data Types Integer: An integer value may be any positive or negative whole number, e.g. 24, -6. Real: A real value is taken to mean a number with a fractional part, e.g. 3.65. String: A string is any single or group of characters, e.g. “Peter” Boolean: A boolean value is a two-state value. It can either be True or False

2 Higher Grade Computing Studies 3. High Level Language Constructs Higher Computing Software Development S. McCrossan 2 Structured Data Types Array: An array is a set of data all sharing the same variable name which can be accessed by means of a subscript.

3 Higher Grade Computing Studies 3. High Level Language Constructs Higher Computing Software Development S. McCrossan 3 Modularity Modularity is a feature of well written code and it means to divide a larger program into parts that work together to complete the program’s task. Subroutines (also known as subprograms or procedures) and functions allow programs to be written in modular form.

4 Higher Grade Computing Studies 3. High Level Language Constructs Higher Computing Software Development S. McCrossan 4 Modularity Procedures are sections of code which do a specific set of tasks in the program, and which have been grouped separately so that they are called (brought into use) during the running of the program. A function is similar to a procedure in that it is also a section of code which does a specific task in the program, and which is called (brought into use) during the running of the program. The difference between a procedure and a function is that: a procedure produces an effect, whereas a function produces a single value.

5 Higher Grade Computing Studies 3. High Level Language Constructs Higher Computing Software Development S. McCrossan 5 Parameters Parameters are used to pass data to/from subprograms. The statement : calculate_volume(l, b, h) means that the subprogram calculate_volume uses as its data the variables l, b and h. l,b and h are known as the actual parameters because they are the ones passed into the procedure.

6 Higher Grade Computing Studies 3. High Level Language Constructs Higher Computing Software Development S. McCrossan 6 Parameters The procedure to do the calculation will start like this : procedure calculate_volume(length,breadth,height) length,breadth and height are known as the formal parameters because they are the ones used by the procedure.

7 Higher Grade Computing Studies 3. High Level Language Constructs Higher Computing Software Development S. McCrossan 7 Parameters Value parameters result in a copy of the original. They cannot be passed out of the subprogram and used elsewhere. They are safer to use as the original is unaffected and so it cannot be accidentally altered. If a value parameter has its value changed within a procedure, this change of value will not be passed back out of the procedure. It will revert back to the value it had before entering the procedure.

8 Higher Grade Computing Studies 3. High Level Language Constructs Higher Computing Software Development S. McCrossan 8 Parameters Reference parameters alter the value of the variables themselves. They can be passed out and used elsewhere but can result in accidental alteration of a variable. If a reference parameter has its value changed within a procedure, this change of value will be passed back out of the procedure.

9 Higher Grade Computing Studies 3. High Level Language Constructs Higher Computing Software Development S. McCrossan 9 Scope of variables Local Variables Local variables are variables which exist only within a subprogram. They cannot be accessed or assigned a value except within that subprogram. Global Variables Global variables are variables which are used in any and every part of a program, including subprograms. They should always be used with care and preferably should not be used within subprograms if at all possible.

10 Higher Grade Computing Studies 3. High Level Language Constructs Higher Computing Software Development S. McCrossan 10 Scope of variables The scope of a variable is the parts of the program it can be used in. If a variable is used throughout the whole program, both in the main program and procedures, then its scope is global. If the variable, however, can only be used within one procedure then its scope is only within that procedure.

11 Higher Grade Computing Studies 3. High Level Language Constructs Higher Computing Software Development S. McCrossan 11 String Operations Concatenation is a process where a string is joined to another string to make a larger string, e.g. “sauce” + “pan” = “saucepan”.

12 Higher Grade Computing Studies 3. High Level Language Constructs Higher Computing Software Development S. McCrossan 12 String Operations Substrings are parts of larger strings that can be ‘pulled out’ and used.

13 Higher Grade Computing Studies 3. High Level Language Constructs Higher Computing Software Development S. McCrossan 13 Formatting Input and Output Languages can have a range of sophisticated input methods (ways of letting the user enter data) such as text boxes, radio buttons, spin boxes, drop down menus, etc, or it may just be limited to keyboard input. You may also be able to change the way text looks on screen by altering the colour, font, size, style and alignment of text.

14 Higher Grade Computing Studies 3. High Level Language Constructs Higher Computing Software Development S. McCrossan 14 CASE statements The CASE statement allows for multiple outcomes. It removes the need for many IF…THEN…ELSE statements and is clearer for the programmer, or whoever is reading the programming code, to understand.


Download ppt "Higher Grade Computing Studies 3. High Level Language Constructs Higher Computing Software Development S. McCrossan 1 Simple Data Types Integer: An integer."

Similar presentations


Ads by Google