LOTUSSCRIPT 言語
例 2 (Execute 関数)' You can use the Execute function to return an integer such ' as a status code.In this example, the Execute function ' performs the calculation entered by the user.If the result ' is less than 0 or greater than 1 (100%), Execute returns a ' status code, and the ComputeInterest sub displays an ' appropriate message. Sub ComputeInterest Dim script As String, calc As String, retcode As Integer calc$ = InputBox("Compute loan interest (charge/loan)") script$ = _ |Option Declare Sub Initialize Dim pct As Single pct!= | & calc$ & | If pct!< 0 Then End -2 ' -2 is a status code. ElseIf pct!> 1 Then End -3 ' -3 is a status code. End If MessageBox("Interest is " & Format(pct!,"percent")) End Sub| retcode% = Execute (script$) If retcode% = -2 Then MessageBox("You computed a negative interest rate!") ElseIf retcode% = -3 Then MessageBox("You computed an excessive interest rate!") End If End Sub ComputeInterest ' Call the sub.
関連項目