0

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 ;

3
Contributors
4
Replies
6
Views
7 Years
Discussion Span
Last Post by vedro-compota
1

>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.

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;
Votes + Comments
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.