case statement

In programming, a variation of the ifthenelse statement that is used when several ifs are required in a row. The following C example tests the variable KEY1 and performs functions based on the results. switch (key1) { case ‘+’: add(); break; case ”: subtract(); break; case ‘*’: ,multiply(); break; case ‘/’: divide(); break; }

case statement
Trong lập trình, một biến thiên của mệnh đề ifthenelse được dùng khi nhiều mệnh đề ifs được yêu cầu trong một hàng. VÍ dụ C sau đây kiểm tra biến KEY1 và thực hiện các chức năng dựa vào các kết quả.


Published:

PAGE TOP ↑