Switch

Search Knowledge Base by Keyword

< Back

This action is for creating a switch mechanism for flow control.  The initial step of this action is to choose the Visual Basic Data Type (Int32, String etc.)  that will be used to control the Switch. The Switch statement is a multiway branching mechanism based on a defined set of cases. It is an alternative to an if-else construct.

Switch Properties:

Property NameData TypeProperty TypeProperty Description
Display NameStringThe name of the flowchart action box.
ExpressionVisual Basic Activity (block of 1 or more statements)This property defines the Activity of the Switch mechanism (which operates on the Data Type specified when the Switch action is dragged to the Flowchart canvas).

Example pseudo-code:

Assume we choose Int32 as our DataType

Variable i is DataType Int32
i=2
switch (i)

Case 1:  print ("Hello 1"); break;

Case 2: print ("Hello, hello 2"); break;

Case 3: print ("Hello, hello, hello 3");break;

default: print ("No case for given %i");break;
end switch

Output:
Hello, hello 2