3. Statements : OpenROAD Language Statements : If-Then-Else Statement : Examples—If-Then-Else Statement
 
Share this page                  
Examples—If-Then-Else Statement
Set a status variable if no employee number was entered in the empnum field:
if empnum = 0 then
     employee_number = 'None';
endif;
Prompt for a value if no employee number was entered in the empnum field:
if empnum = 0 then
     enum = prompt 'Please enter employee number';
endif;
Control the flow of frames within an application based on the value in the status variable in the current frame:
if status = 'n' then
     callframe new;
elseif status = 'c' then
     callframe completed;
else
     callframe inprogress;
endif;
Nest multiple if statements:
if status = 'n' then
     if empnum = 0 then
          employee_number = 'None';
     else
          callframe NewEmp;
     endif;
endif;