exit repeat instruction

Description

The exit repeat instruction is used to exit (leave) a repeat loop. The script execution then continues with the instruction following the end repeat instruction.

Syntax

Table 8.18. exit repeat syntax

ProductionSyntaxLinks
exit_repeat_instruction "exit" "repeat" identifier ?

remarks:

  • if identifier is omitted then the innermost repeat loop is exited in case of several nested repeat loops
  • if identifier is specified, then the repeat loop identified by identifier is exited

the section called “exit repeat instruction”

Examples

Example 8.21. exit repeat example

The following code first creates some table data and then checks if any cell in the table is void:

service instruction_examples

   command exit_repeat_example_1
      script
      
         // create table data provider with 2 rows and 4 columns, and containing some simple test data
         const positive32 row_count = 2
         const positive32 column_count = 4
         const table_data_provider table_data_provider = fa_table_data_provider_for_tests.co_create ( &
         	i_row_count = c_row_count &
         	i_column_count = c_column_count )
         	
         // check if the table contains any void cells

         var yes_no void_cell_found = no         	
         repeat from row_index = 1 to c_row_count id: row_loop     // loop through all rows
            repeat from column_index = 1 to c_column_count         // loop through all columns
            
               if c_table_data_provider.co_cell_value ( &
                  i_row_index = v_row_index &
                  i_column_index = v_column_index ) =r void then
                  v_void_cell_found = yes
                  exit repeat row_loop
               end if

            end repeat
         end repeat
         
         if v_void_cell_found then
            //...
         end if

      end script
   end command
   
end service

see also:

See also