Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I collapse code for a case in a switch?

Inside a JavaScript switch instruction, different case(s) may contain much code. Therefore it could be useful to collapse (fold) the code for cases other than the one I am working on.

I use Netbeans. How do I do that?

like image 253
Brice Coustillas Avatar asked Jan 21 '26 08:01

Brice Coustillas


1 Answers

Previously unknown to me, but very handy!

Put braces around the code that is inside the case: Netbeans will display the fold/unfold symbol then you can proceed as usual.

switch (kNumCell)
{
    case "0":
    {
      // code comes here
    }
    break;
     // …
}
like image 142
Brice Coustillas Avatar answered Jan 23 '26 22:01

Brice Coustillas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!