Skip to content

foreach (Looping & Flow Control)

Compatible with:
  • Purpose
  • Iterates a block of code, once for each value. 'foreach' command must always have 'endForeach' at the end of the block. If either Target or Value fields are NULL, the command fails during test execution.

    If you have a set of values where a comma is present in a string, you can give that string within the double quotes to differentiate between multiple strings as stated below:
    "Accessories, Tools", "Front Brakes" Here, "Accessories, Tools" is now considered as a single string
    or the below syntax would also work as is which is separated by a comma:
    1,2,3,4
  • Syntax
  • foreach(variableName, comma-separated-values)
  • Target
  • variableName - Variable to iterate over comma-separated-values values.
  • Value
  • comma separated values (comma separated values for which the Variable is iterated.)
  • Return Value
  • N/A

 

Feedback and Knowledge Base