TAILIEUCHUNG - asp net 2.0 all in one desk reference for Dummies PHẦN 5

Mặc định là chủ nhật. Chỉ ra các nút chuyển sang tháng tiếp theo và trước đó được hiển thị. Tùy chọn là CustomText, ShortMonth, hoặc FullMonth. Các văn bản hiển thị cho các nút dẫn đến tháng tiếp theo. Mặc định là một, một dấu hiệu lớn hơn. | Putting the Ot Switch-er-oo 347 But with an or operator you can do the same thing with a compound condition which looks like this if salesTotal salesClass 3 commissionRate To evaluate the expression for this if statement C first evaluates the expressions on either side of the operator. Then if at least one of them is true the whole expression is true. Otherwise the expression is false. In most cases you should use the conditional or operator instead of the regular or operator like this if salesTotal salesClass 3 commissionRate Like the conditional and operator the conditional or operator stops evaluating as soon as it knows what the outcome is. For example suppose the sales total is 500. At that point there s no need to evaluate the second expression. Because the first expression evaluates to true and only one of the expressions needs to be true C can skip the second expression altogether. Of course if the sales total is 5 000 the second expression must still be evaluated. As with the and operators you should use the regular or operator only if your program depends on some side effect of the second expression such as work done by a method call as described in Chapter 4 of this mini-book. Putting the Ot Switch-er-oo Besides the if statement C offers another statement that s excellent for decision-making the switch statement. The switch statement excels at one particular type of decision-making choosing one of several actions based on a value stored in an integer or string variable. As it turns out the need to do just that comes up a lot. So you want to keep the switch statement handy when such a need arises. Creating etse-if monstrosities Many applications call for a simple logical selection of things to be done depending on some value that controls everything. Such tasks are often handled with big chains of else-if statements all strung together. Book IV Chapter 2 Doing Things Conditionally in C 348 Putting the Ol Switch-er-oo If you feel a

TỪ KHÓA LIÊN QUAN
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.