LotusScript:嵌套的 if 语句?

LotusScript: nested if statements?

正在翻译 lotusScript,我不确定这些 if 语句是否嵌套

If doc.Ventilation(0) = "Power" Then
    If doc.TypeInlet(0) = "8'' Continious" Or doc.TypeInlet(0) = "12'' 
    Continious" Then
    num_inlet_rows = doc.Width(0) \ inlet_row
         If doc.Width(0) Mod inlet_row > .4 Then num_inlet_rows = 
         num_inlet_rows + 1
         If num_inlet_rows Mod 2 <> 0 Then num_inlet_rows = num_inlet_rows+1 
         If (num_inlets_power / num_inlet_rows) > doc.Length(0) Then 
         num_inlet_rows = num_inlet_rows + 2
    Else
         l = 11
         While (doc.Length(0) / num_inlet_columns) < ((doc.Width(0) / 
         num_inlet_rows) / 1.20) And (l > 0)
              l = l - 1
              num_inlet_rows = num_inlet_rows + 1
         Wend
    End If
    ...
End If

Here's the code, couldn't figure out how to format correctly

您错过了一个 End If 声明:

If doc.Ventilation(0) = "Power" Then
    If doc.TypeInlet(0) = "8'' Continious" Or doc.TypeInlet(0) = "12'' Continious" Then
        num_inlet_rows = doc.Width(0) \ inlet_row
        If doc.Width(0) Mod inlet_row > .4 Then num_inlet_rows = num_inlet_rows + 1
        If num_inlet_rows Mod 2 <> 0 Then num_inlet_rows = num_inlet_rows+1 
        If (num_inlets_power / num_inlet_rows) > doc.Length(0) Then 
            num_inlet_rows = num_inlet_rows + 2
        Else
            l = 11
            While (doc.Length(0) / num_inlet_columns) < ((doc.Width(0) / num_inlet_rows) / 1.20) And (l > 0)
                l = l - 1
                num_inlet_rows = num_inlet_rows + 1
            Wend
        End If
        '...
    End If
End If

Lotusscript 中有两种 if- 语句。

第一个是用ONE LINE写的,没有换行。它不需要 end if 语句并在行尾结束。它不嵌套。

If x = 3 then y = y + 1 else y = y - q

是这些“单行者”的一个例子。 该语句是完整的,没有嵌套其他代码。您甚至可以像示例代码中那样省略 else- case。

第二个不止一行。它需要一个结束 if 语句才能完成:

If x = 4 then
  y = y + 1
Else
  y = y - 1
End if

完全一样,但是这里可以在then if和else和end if之间多放一些代码:可以嵌套。

也就是说:你的。 Ode 两者兼而有之,部分嵌套,部分不嵌套。我想,你现在可以认清自己了,哪个就是哪个。