Hi thete )Tell me please -
am I right -
if fillnumb=0 then after executing this code -

switch (fillnumb)
                       {
                           case 0: 
                              [B] fillnumb[/B] = 1;
                               break;
                           case 1:
                               [B]fillnumb[/B] = 2;
                               break;
                       }

fillnumb will be =2 ;

Recommended Answers

All 4 Replies

>fillnumb will be =2
Why would it be? If fillnumb is 0, then that falls into your case 0, which sets fillnumb to 1. A break at the end of a case terminates the switch statement, so execution won't fall through to case 1.

The following if-statement is equivalent to your switch statement. You can see from this code that Narue is correct:

if (fillnumb == 0)
  fillnumb = 1;
else if (fillnumb == 1)
  fillnumb = 2;
commented: ++ +1

thank you for good explanation, darkagn ))

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.