Home > VHDL > Concurrent Statements > Return statements

Return Statement :

Return statement finishes the execution of a subprogram and supports jump to the end of a subprogram. If return statement is inside subprograms it can be used to inner subprogram. This statement should be used in function. The syntax is :


return expression ;
return ;

Example :

 procedure RS_FF ( signal S,
R: in BIT; signal Q, NQ: inout BIT) is 
 begin 
 if (S = '1' and R = '1') then
 report
"forbidden state: S and R are equal to '1'"; 
 return; 
 else 
 Q <= S and
NQ after 5 ns; 
 NQ <= R and
Q after 5 ns; 
 end if; 
 end
procedure RS_FF;