LOTUSSCRIPT LANGUAGE


Using the If...GoTo...Else statement to transfer unconditionally
The branching statement If...GoTo...Else is a convenient way to abbreviate a statement that would otherwise be written If...Then GoTo label Else. It can be used when the only action you want to take in the Then clause of an If...Then...Else statement is to transfer unconditionally. The description of If...Then...Else applies to this statement, with the GoTo clause substituted for the Then clause. The statement must be written on one line.

For example, here is the executable part of the sub from the preceding example, revised to use If...GoTo (there is no Else clause in this case):

   approx! = .25
  iters% = 0
ReIter:
  iters% = iters% + 1
  tempProx! = approx!
  approx! = .25 ^ tempProx!
  If Abs(tempProx! - approx!) >= .0001 And iters% < 40 _
     GoTo ReIter
  Print approx!, Abs(approx! - tempProx!), "Iterations:" iters%

See Also