Selection occurs when you want to take different paths based on certain criteria. We know this sort of action as an IF statement. It is a control statement which will change the flow of the program. In order to show selection in JSP we must use two or more fundamental operations. Effectively we can then say that we are going to one of many different fundamental operations. We can add selection to our serial search easily as we already know that we must do a comparison using a IF statement. For each element we must check to see if it is what we are looking for or not. I.e. if it is found or not.

In this case we have two options. The first is that the element has been found and we should stop processing. The second is that its not found and should continue. We denote selection by the "0" symbol in the top right hand corner. This is the exact same style as iteration.