Scripting > mrScriptBasic overview > mrScriptBasic language reference > Statements > GoTo
 
GoTo
Unconditionally transfers control to a specified line in the script.
Syntax
Goto location
Argument
location
The line label or section name to transfer execution to.
Remarks
The line label or section specified in the GoTo statement must exist within the script. A line label must conform to the Naming conventions, and must end with a colon. You cannot combine a line label and a statement on one line and a line label cannot appear within another control statement.
Too many GoTo statements can make code difficult to read and debug. It is recommended that you use structured control statements (Do...Loop, For...Next, If...Then...Else, Select Case) whenever possible.
Examples
Data Management example
If gender.AnswerCount() > 1 Then
DataCleaning.Status = {NeedsReview}
GoTo NoMoreChecks
End If
.
.
.
NoMoreChecks:
Job.GlobalVariables.mytextfile.Value.WriteLine(strDetails)
UNICOM Intelligence Interviewer example
' Ask about wines tasted
WinesTasted.Ask()
If WinesTasted = {REF} Then
' No need to ask any more wine questions
GoTo SummaryQuestions
End If

Rating[..In WinesTasted].Ask()
Cost[..In WinesTasted].Ask()

SummaryQuestions:
' Ask the standard demographic questions
Demo.Ask()
See also
Statements