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.