Developer Documentation Library > Scripting > mrScriptBasic overview > mrScriptBasic language reference > Statements > GoTo
 
GoTo
The GoTo statement 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.
The line label or section specified must exist in 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. A line label cannot appear within another control statement.
Remarks
Too many GoTo statements can make code difficult to read. 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