Similar to the C programming language, GLSL supports loops and branching, including: if-else, for, do-while, break, continue, etc.
User-defined functions are supported, and a wide variety of commonly used functions are provided built-in as well. This allows the graphics card manufacturer the ability to optimize these built-in functions at the hardware level if they are inclined to do so. Many of these functions are similar to those found in the math library of the C programming language, such as exp() and abs(), while others are specific to graphics programming, such as smoothstep() and texture2D().