<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # ASP.NET Razor - VB 邏輯條件 編程邏輯:根據條件執行代碼。 ## If 條件 VB 允許根據條件執行代碼。 使用 **if 語句**來判斷條件。根據判斷結果,if 語句返回 true 或者 false: * if 語句開始一個代碼塊 * 條件寫在 if 和 then 之間 * 如果條件為真,if ... then 和 end if 之間的代碼被執行 ## 實例 ``` @Code Dim price=50 End Code <html> <body> @If price>30 Then @<p>The price is too high.</p> End If </body> </html> ``` [運行實例 ?](/try/showfile_vb.php?filename=try_razor_vb_010) ## Else 條件 if 語句可以包含 **else 條件**。 else 條件定義了當條件為假時被執行的代碼。 ## 實例 ``` @Code Dim price=20 End Code <html> <body> @if price>30 then @<p>The price is too high.</p> Else @<p>The price is OK.</p> End If </body> </htmlV> ``` [運行實例 ?](/try/showfile_vb.php?filename=try_razor_vb_011) **注釋:**在上面的實例中,如果第一個條件為真,if 塊的代碼將會被執行。else 條件覆蓋了除 if 條件之外的"其他所有情況"。 ## ElseIf 條件 多個條件判斷可以使用 **elseif 條件**: ## 實例 ``` @Code Dim price=25 End Code <html> <body> @If price>=30 Then @<p>The price is high.</p> ElseIf price>20 And price<30 @<p>The price is OK.</p> Else @<p>The price is low.</p> End If </body> </html> ``` [運行實例 ?](/try/showfile_vb.php?filename=try_razor_vb_012) 在上面的實例中,如果第一個條件為真,if 塊的代碼將會被執行。 如果第一個條件不為真且第二個條件為真,elseif 塊的代碼將會被執行。 elseif 條件的數量不受限制。 如果 if 和 elseif 條件都不為真,最后的 else 塊(不帶條件)覆蓋了"其他所有情況"。 ## Select 條件 **select 塊**可以用來測試一些單獨的條件: ## 實例 ``` @Code Dim weekday=DateTime.Now.DayOfWeek Dim day=weekday.ToString() Dim message="" End Code <html> <body> @Select Case day Case "Monday" message="This is the first weekday." Case "Thursday" message="Only one day before weekend." Case "Friday" message="Tomorrow is weekend!" Case Else message="Today is " & day End Select <p>@message</p> </body> </html> ``` [運行實例 ?](/try/showfile_vb.php?filename=try_razor_vb_013) "Select Case" 后面緊跟著測試值(day)。每個單獨的測試條件都有一個 case 值和任意數量的代碼行。如果測試值與 case 值相匹配,相應的代碼行被執行。 select 塊有一個默認的情況(Case Else),當所有的指定的情況都不匹配時,它覆蓋了"其他所有情況"。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看