8.7 IF

...
ENTITY e IS
    ...
BEGIN
    ...
END e ;

...
ARCHITECTURE a OF e IS
    ...
BEGIN
    ...
END a ;

...
CONFIGURATION c
        OF e IS
    ...
    ...
    ...
END



...
PACKAGE pkg IS
    ...
    ...
    ...
END pkg ;

if_statement ::=
[ if _label : ]
    if condition then
        sequence_of_statements
    { elsif condition then
        sequence_of_statements }
    [ else
        sequence_of_statements ]
    end if [ if _label ] ;



..
PACKAGE BODY pck
        IS
    ...
    ...
    ...
END pck ;

...
b: BLOCK IS
    ...
BEGIN
    ...
END BLOCK b ;

FUNCTION f (...)
    RETURN r IS
    ...
BEGIN
    ...
END f ;

PROCEDURE p (...) IS
    ...
BEGIN
    ...
END p ;

p : PROCESS
    ...
BEGIN
    ...
END PROCESS p ;

8.7.1 Further definitions

label ::= identifier

condition ::= boolean _expression

sequence_of_statements ::=
    { sequential_statement }

8.7.2 Examples

IF a = '1' THEN
   b := '0' ;
END IF ;


If a has the value 1 then b is assigned the value 0 .

IF a > 0 THEN
   b := a ;
ELSE
   b := ABS ( a + 1 ) ;
END IF ;


If the value of a is bigger than 0 then b is assigned
the value of a, otherwise that of ABS ( a + 1 ).

IF val >= 5 AND val < 10 THEN
   int := 7 ;
ELSIF val < 5 THEN
   int := val + func( val + 2 ) ;
ELSIF val < 15 THEN
   int := func( val ) ;
ELSE
   int := 0 ;
END IF ;


This is an example of a complete IF - ELSIF -loop.
The conditions are checked one after the other.
When the first match is found the relevant actions
are carried out and the IF -loop is left.