Selection: CASE
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · 이 페이지는 최신 브라우저(SharedArrayBuffer 지원)가 필요합니다. Chrome, Edge, Firefox 또는 Safari를 최신 버전으로 업데이트해 주세요.
English
CASE OF picks one branch
- A
CASEruns the branch whose value matches the variable. - Branches are tested in order. The first match runs, and the rest are skipped.
OTHERWISEis the branch for every other value. It comes last.
한국어
CASE OF는 하나의 가지만 선택합니다
CASE은 변수의 값과 일치하는 가지를 실행합니다.- 가지는 순서대로 테스트됩니다. 첫 번째 매칭이 실행되고 나머지는 건너뜁니다.
OTHERWISE은 나머지 모든 값에 대한 기본 가지입니다. 가장 마지막에 위치합니다.
English
한국어
DECLARE Move : CHAR
Move ← 'W'
CASE OF Move
'W' : OUTPUT "west"
'E' : OUTPUT "east"
OTHERWISE : OUTPUT "other"
ENDCASE
English
Watch out
- A character value uses single quotes:
'W'. - Each branch is one statement here. A longer branch is easier to read as an
IF.
한국어
주의사항
- 문자열 값은 단일 따옴표를 사용합니다:
'W'. - 각 분기는 여기서 하나의 문장입니다. 더 긴 분기는
IF로 읽기 easier합니다.
English
Common mistakes
- Close the block with
ENDCASE. - Put a colon after the value, and after
OTHERWISE.
한국어
흔한 실수
ENDCASE로 블록을 닫습니다.- 값 뒤에 콜론을 넣고,
OTHERWISE뒤에도 콜론을 넣으십시오.
English
Now you try
- Read a character and choose a word with
CASE OF.
한국어
이제 직접 해보기
- 문자를 읽고
CASE OF와 일치하는 단어를 선택하십시오.
Read a CHAR Move. Output west for W, east for E, and other for anything else.
Click Run to see the output here. · 출력을 보려면 '실행'을 클릭하세요.