Lesson 9 of 34
switch: कई values में से चुनना
8 min 30 XP
switch एक value के आधार पर कई रास्तों में से एक चुनता है। हर case के अंत में break चाहिए, वरना अगला case भी चल जाता है (fall-through)। कुछ भी match न हो तो default चलता है।
Example: edit me and press Run
Output Loading Java (first time takes a few seconds)
Press Run to see the result here.switch String और char values के साथ भी काम करता है। यह रहा एक छोटा calculator।
Example: edit me and press Run
Output Loading Java (first time takes a few seconds)
Press Run to see the result here.