Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Arduino control statement


May 15, 2021 Arduino



The judgment structure requires the programmer to specify one or more conditions to evaluate or test by the program, as well as statements to execute when the condition is true (required) and statements to execute when the condition is false (optional).

The following is a general form of judgment structure typical of most programming languages:


Arduino control statement


A control statement is an element of the source code that controls the execution process of a program. They are:

Serial number Control statements and descriptions
1

If statement

It takes an expression in parentheses, followed by a statement or block of statements. /b10> If the expression is true, execute statements or blocks of statements, otherwise skip them.

2

If ... Else statement

An if statement can be followed by an optional else statement, which is executed when the expression is false.

3

If ... e lse if ... Else statement

The if statement can be followed by an optional else if ... Else statement, which is useful for testing various conditions.

4

Switch case statement

Similar to an if statement, switch ... Case controls the process of a program by allowing the programmer to specify different codes that should be executed under various conditions.

5

Conditional operator ? :

Conditional operator? ge.