+ 2

Can you teach me what is break statement and switch block

i didn't understand from this bcoz it is confusing me

30th Dec 2016, 1:56 PM
Anna Ash867
Anna Ash867 - avatar
3 Respuestas
+ 1
break statement a break statement is used to go out from the box you're inside the box may be for loop or while loop or switch statement. switch statement its like a gun with options ex switch (x) { case 1; case 2; default; } each case is an aim to the gun one of them is present you shot it .
30th Dec 2016, 3:02 PM
Jamal Al-kelani
Jamal Al-kelani - avatar
+ 1
break statements are used to go outside of the nearest block of loops or switch.
1st Jan 2017, 6:56 AM
Ashwaghosh Sadanshiv
Ashwaghosh Sadanshiv - avatar
0
Switch works as else if ladder I matches the value of variable with the given cases when a match is found the case is executed and then there's a need to break the process of matching further or executing the further cases that's why break is used to jump outa switch block
31st Dec 2016, 7:57 AM
Raj Kumar