Case
Begin Case / Case / End Case (स्टेटमेंट)
प्रारूप
begin case
(टैब)case बूलियन_व्यंजक
(टैब)(टैब)स्टेटमेंट
(टैब)case बूलियन_व्यंजक
(टैब)(टैब)स्टेटमेंट
(टैब)else
(टैब)(टैब)स्टेटमेंट
end case
विवरण
case संरचना से प्रोग्रामर कई शर्तों को जाँचने वाली संरचना बना सकता है। केवल पहली सत्य शर्त वाला हिस्सा चलता है और बाकी सभी शर्तें छोड़ दी जाती हैं। अगर आख़िरी शर्त के रूप में वैकल्पिक else है, तो कोई और शर्त पूरी न होने पर वह चलता है।
उदाहरण
for t = 1 to 10
begin case
case t < 3
print t + " is less than 3"
case t < 7
print t + " is less than 7 but 3 or larger"
else
print t + " is 7 or larger"
end case
next t
यह दिखाएगा:
1 is less than 3
2 is less than 3
3 is less than 7 but 3 or larger
4 is less than 7 but 3 or larger
5 is less than 7 but 3 or larger
6 is less than 7 but 3 or larger
7 is 7 or larger
8 is 7 or larger
9 is 7 or larger
10 is 7 or larger
यह भी देखें
Begin Case / Case / End Case, Call, Continue Do, Continue For, Continue While, Do / Until, End, Exit Do, Exit For, Exit While, For / Next, For Each / Next, Function, Global, Goto, Gosub, If Then, Pause, Ref, Rem, Return, Subroutine, While / End While
इतिहास
| 1.0.0.9 | इस संस्करण में नया |