Desktop User Guides > Professional > Interview scripting > Writing interview scripts > Other flow control statements > Jumping to a named location in the routing script
Jumping to a named location in the routing script
In long or complicated routing sections it can be helpful to organize the code into named sections. Named sections can be a useful alternative to long If...Then...Else statements with complex expressions, because you can simply place all the statements that apply to one group of respondents in a named section and then jump direct to the sections that apply to the current respondent. Although the effect on the interview is the same, you might find that using named sections makes the script easier to follow because each section stands alone rather than being part of a larger statement.
To name a section in the routing section, type the name on a line by itself and follow the name with a colon:
On the next lines, type the statements that belong in that section (you can indent these statements to highlight the fact that they are part of a section. The section extends until the next section name is reached, or until the end of the routing section. For example:
The GoTo keyword jumps to a named location in the routing section of an interview script. You'll often use it when you want to skip a question or set of questions that do not apply to the current respondent.
To specify a jump (or skip), type:
GoTo location
location is a location name in the script.
You can use GoTo as a statement by itself, in which case it applies to every interview that reaches the GoTo statement, but you're more likely to use it as part of an If statement when you want to ask some questions of certain respondents only. Respondents who should not see the questions will be sent past them with a GoTo statement. For example:
If (RailwayWorker = {Yes}) Then GoTo Terminate
sends people who are railway workers straight to the end of the script because they are not eligible to be interviewed.
Normally, you'll be jumping forwards in the script, but backward jumps are also permitted. However, if you jump backwards in the script, make certain that you are not creating an infinite loop, where you are continually repeating the same set of statements. The interviewing program has a mechanism for dealing with infinite loops, but it is better to avoid creating them in the first place.
See also
Other flow control statements