Language basics
Before we begin, I expect you to have a basic understanding and proficiency of C. OpenGL is available in different programming languages such as Java, Python, or C#. However, I will be concentrating on the C/GLSL concepts.
Instructions
The instructions always end with a semicolon, and there could be more than one per line:
c = cross(a, b); vec4 g; g = vec4(1, 0, 1, 1);
A block of instructions is created by putting them in brackets. All variables declared inside a block will be destroyed when the block finishes. If two variables have the same name—one declared outside the block (also called scope) and another declared inside the block—by default, the inner variable is the one which will be referenced:
float a = 1.0; float b = 2.0; { float a = 4.0; float c = a + 1.0; // c -> 4.0 + 1.0 } b = b + c; // wrong statement. Variable c does not exist here
Tabulations or whitespaces don't change the semantics of the language. You can use them to format the code at your wish.