Programming language basic elements


by - posted

Programming language basic elementsIn this article, I will give you a summary of my document Programming language basic elements. This document is a guideline for teachers in basics for programming.

Variables

At the core of any program are variables. Variables are “boxes” for storing information.
The scope of a variable is simply the part of code where you can “see” and use it.
Local variables are usually variables only accessible in a function. Global variables are accessible in the whole program. The lifetime of a variable means how long it exists and “lives” in the memory.

Data types

A variable’s data type indicates what sort of value the variable represents. This can be an integer, float, string or boolean.

Operators

We distinguish arithmetic, comparison, logical and assignment operators.

User input / output

The user input and output means simply instructions, which get data from the keyboard (input) and put data to the screen (output).

Control flow structures

A control flow structure is a block of programming that analyzes variables and chooses in which direction the program flow goes based on given parameters.  We have basically four control flow instructions : the IF (if this is true do that), the SWITCH (if the cases 1,2,3,4,5,6,7 are true do the specific task), FOR (loop until the counter reaches the value) and WHILE  (loop until the condition is met)

Compound data structure Array

An array is a special variable, which can store multiple values in it. Values in arrays can be accessed by using the index associated to them.
There are numeric and associative arrays. Numeric arrays haves a numeric index, associative arrays have an non numeric index.

Compound data structure Object

Object-oriented programming is a method of programming, based on a hierarchy of classes and well-defined, cooperating objects. Classes and objects are the two main aspects of object oriented programming. Classes can be used to generate multiple instances. Such instances are called objects. An object is a particular instance of a class.
Objects have 2 parts, namely methods and properties. Methods describe how an object can be used or what it can do. Properties describe an object’s characteristic.

Functions

A function is a group of code that has been given a name. By grouping a block of code together and naming it, we can re-use it later and throughout the application without having to rewrite the whole code block again.

If you want more information, you can get my PDF document for free, no e-mail required for downloading, no fancy marketing tricks. It’s just FREE ! Click on Programming language basic elements to start the download.

If you enjoyed this article, you can :

– get post updates by subscribing to our e-mail list

– share on social media :

Leave a comment Cancel reply