Lesson 9 of 34
switch: பல மதிப்புகளில் ஒன்றைத் தேர்வு செய்தல்switch: Choosing Between Many Values
8 min 30 XP
ஒரு variable-ன் மதிப்பைப் பொறுத்து பல வழிகளில் ஒன்றைத் தேர்வு செய்ய switch பயன்படுகிறது. ஒவ்வொரு case-ன் முடிவிலும் break வேண்டும், இல்லையெனில் அடுத்த case-ம் இயங்கும். எதுவும் பொருந்தவில்லை என்றால் default இயங்கும்.
switch picks one of many paths based on a value. Each case needs a break at the end, or the next case runs too (fall-through). default runs when nothing matches.
Example: edit me and press Run
Press Run to see the result here.switch, String மற்றும் char மதிப்புகளுடனும் வேலை செய்யும். கீழே ஒரு சிறிய calculator.
switch also works with String and char values. Here is a tiny calculator.
Example: edit me and press Run
Press Run to see the result here.