VBScript အပြည့်အဝါ
- ပြီးပြီးခြင်း VB အပြည့်အဝါ
- နောက်ပိုင်း VB စကားရပ်
အမှတ်စဉ်
- If...then..else ဖော်ပြ
- ဒါက အကြောင်းလုပ် ကျသည့် if...then..else ဖော်ပြမှု
- If...then..elseif ဖော်ပြ
- ဒါက အကြောင်းလုပ် ကျသည့် if...then...elseif... ဖော်ပြမှု
- Select case ဖော်ပြ
- This example demonstrates how to write a select case statement.
Conditional statements
Frequently, when we write code, we need to perform different operations based on different judgments. We can use conditional statements to complete this work.
In VBScript, we can use three conditional statements:
- if statement
- If you want to execute a series of code when the condition is true, you can use this statement.
- if...then...else statement
- If you want to execute one of the following sets of code, you can use this statement.
- if...then...elseif statement
- If you want to execute one of the following sets of code, you can use this statement.
- select case statement
- If you want to execute one of the following sets of code, you can use this statement.
If....Then.....Else
In the following cases, you can use the If...Then...Else statement:
- Execute a piece of code when the condition is true
- Choose one of the two pieces of code to execute
အချက် true ဖြစ်လျှင် အမှု တစ်လျှောက် ရေးသားရန် လို့မူကား
if i=10 Then msgbox "Hello"
ဤအချက်တွင် အကြောင်းသတင်း .else.. မရှိပေ။ ကြောင်းစကား true ဖြစ်သော် အမှု တစ်ခုသာ လုပ်ဆောင်သည်(i 10 ဖြစ် သော်လည်း)
ဤအချက်တွင် အချက် true ဖြစ်လျှင် အမှုများ လုပ်ဆောင်ရန် လို့မူကား တစ်လျှောက်တစ်ခု ရေးသားပြီး အကြောင်းသတင်း "End If" ကို အဆုံးပါးရမည်
if i=10 Then msgbox "Hello" i = i+1 end If
အထဲတွင် အကြောင်းသတင်း .else.. ကြောင်းစကား မရှိပေ။ ကြောင်းစကား true ဖြစ်သော် အမှုများ လုပ်ဆောင်သည်
ဤအချက်တွင် အချက် true ဖြစ်လျှင် ကြောင်းစကား လုပ်ဆောင်ရန် ရည်ရွယ်သည်ကို လုပ်ဆောင်ရမည်၊ အချက် false ဖြစ်ပါက အချက်ကို လုပ်ဆောင်ရမည်ဟူသော အကြောင်းသတင်း "Else" ကို ထပ်ပေါင်းရမည်
if i=10 then msgbox "Hello" else msgbox "Goodbye" end If
အချက် true ဖြစ်လျှင် ပထမပိုင်း ကြောင်းစကား လုပ်ဆောင်ရမည်၊ အချက် false ဖြစ်ပါက ဒုတိယပိုင်း ကြောင်းစကား လုပ်ဆောင်ရမည်(i 10 မဟုတ် သော်လည်း)
If....Then.....Elseif
ဤအချက်တွင် သင် တစ်စင်းမျိုးကို လုပ်ဆောင်ရန် ရည်ရွယ်သည်ကို သုံးစွဲနိုင်သည်။ if...then...elseif စကားလုံးအသုံး
if payment="Cash" then msgbox "You are going to pay cash!" elseif payment="Visa" then msgbox "You are going to pay with visa." elseif payment="AmEx" then msgbox "You are going to pay with American Express." else msgbox "Unknown method of payment." end If
Select Case
If သင် အချို့ အက်ဒီဘင် ကို လက်ခံသင့်သည်ကို လက်ခံရန် ကြိုးစားသည်ကို လက်ခံရန် အသုံးပြုရသည်မှာ SELECT အက်ဒီဘင် ဖြင့် ဖြစ်သည်။
select case payment case "Cash" msgbox "You are going to pay cash" case "Visa" msgbox "You are going to pay with visa" case "AmEx" msgbox "You are going to pay with American Express" case Else msgbox "Unknown method of payment" end select
အထူးအရာ အားဖြင့် အခြေခံ အချက်အလက် သည် ပြီးအထူးအရာ အပေါ် စစ်ဆေးသည်။ အထူးအရာ သည် ပြီးပြီးခြင်း နှင့် တူညီသည်။
- ပြီးပြီးခြင်း VB အပြည့်အဝါ
- နောက်ပိုင်း VB စကားရပ်