I have an array like so:
Dim classes() as String = {"FR%", "SO", "JR", "SR", "SR5"}
I need to loop through these values like so:
For Each value as String in classes
Next
Problem is, I have a If..Then..Else clause inside of this For Each..Next which says something to the effect of:
If actual_class = value Then
txt.Text = "Welcome"
Else
txt.Text = "Goodbye"
When I run this, unless the individual is the last value in the string array (“SR5”) they are going to get the message “Goodbye”…so, I need somehow to both iterate through each value like is done with a For Each..Next loop but also break out of the loop once it hits the student’s class, like a Do..While loop – so that their value doesn’t get overrun by the Else clause.
When you want to break out of the loop do
Exit ForSee For Each and Exit
Updated Example