Monday, 5 February 2018

Coding - Variables & Statements

Variables

Variables have naming conventions such has camel, pascal, and Hungarian. These are the ways that people will name their variables meaningfully and readable.

When coding certain variables are accessible from different areas of the program, this is called scope. Global scope means that the variables can be accessed and edited from anywhere in the program. Local scope means that it is limited to where it was declared and a couple examples would be inside functions and inside brackets after an if statement.

The AND, NOT, and OR operators are logical operators because when one is used in a statement and if it isn't a boolean then it is covered to one. For example if one boolean is true and another is false then if you were checking if one and two were true then it would be in the end false since one of them is false.

Statements

Assignment statements are when a variable is being assigned a value. The variable must be declared to assign it a value and the value must be the correct datatype or be casted to the correct datatype.

An input statement is how a program receives information from a input device and an output statement is how the program will send the data to an output device.

No comments:

Post a Comment

Coding - Variables & Statements

Variables Variables have naming conventions such has camel, pascal, and Hungarian. These are the ways that people will name their variab...