LOTUSSCRIPT LANGUAGE


Examples: GoSub statement
' In response to user input, LotusScript transfers control
' to one of three labels, constructing an appropriate
' message, and continues execution at the statement
' following the GoSub statement.

Sub GetName
  Dim yourName As String, Message As String
  yourName$ = InputBox$("What is your name?")
  If yourName$ = "" Then    ' The user enters nothing.
     GoSub EmptyString
  ' Do a case-insensitive comparison.
  ElseIf LCase(yourName$) = "john doe" Then
     GoSub JohnDoe
  Else
     Message$ = "Thanks, " & yourName$ _
        & ", for letting us know who you are."
  End If
  ' The Return statements return control to the next line.  
  MessageBox Message$
  Exit Sub

EmptyString:
  yourName$ = "John Doe"
  Message$ = "Okay! As far as we're concerned, " _
        & "your name is " & yourName$ & _
        ", and you're on the run!"
  Return

JohnDoe:
  Message$ = "We're on your trail, " & yourName$ _
        & ". We know you are wanted dead or alive!"
  Return
End Sub
GetName    ' Call the GetName sub.

See Also