In computer programming, a statement is a specific instruction in the source code of a program. It is the most basic piece of information in a program, and cannot be separated into smaller instructions. A statement is different from a function or method in that both functions and methods are references to a group of statements, while statements are the instructions themselves.
Types of Statements
There are several kinds of statements; some tell the computer what to do based on conditions, while others instruct the computer to create new objects, and still others help with exception handling.
Control flow statements instruct the computer what to do based on criteria. Examples of this are the if-then-else statement and the ternary operator.
Loop statements continuously execute the code inside of their block until certain requirements are met. Examples of these are the while loop and the for loop.