커뮤니티

조건에 따른 분기문 쓰는데

프로필 이미지
개냥이
2011-11-04 16:52:35
501
글번호 44475
답변완료
input : cond(1); condition1 : 조건1; condition2 : 조건2; condition3 : 조건1 and 정배열수식; condition4 : 조건2 and 역배열수식; if cond==1 then { if condition3==true then { if 조건1 then buy(); } } if cond==0 then { if codition1==true then { if 조건1 then buy(); } } 이런식으로 해서 cond라는 옵션에 따라서 조건적으로 진입구문을 작성해서 동작은 잘 되는데요 위와같이 cond==1 일때와 0일때 다음 조건이 condition3와 condition1로 각각 다르지만 그 안에 포함된 buy()문의 조건1은 모두 동일한데 이것을 좀 더 간단하게 해볼 수 있나 해서요.
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2011-11-07 14:06:50

안녕하세요 예스스탁입니다. if 조건1 then{ if cond==1 then { if condition3==true then { buy(); } } if cond==0 then { if codition1==true then { buy(); } } } 즐거운 하루되세요 > 개냥이 님이 쓴 글입니다. > 제목 : 조건에 따른 분기문 쓰는데 > input : cond(1); condition1 : 조건1; condition2 : 조건2; condition3 : 조건1 and 정배열수식; condition4 : 조건2 and 역배열수식; if cond==1 then { if condition3==true then { if 조건1 then buy(); } } if cond==0 then { if codition1==true then { if 조건1 then buy(); } } 이런식으로 해서 cond라는 옵션에 따라서 조건적으로 진입구문을 작성해서 동작은 잘 되는데요 위와같이 cond==1 일때와 0일때 다음 조건이 condition3와 condition1로 각각 다르지만 그 안에 포함된 buy()문의 조건1은 모두 동일한데 이것을 좀 더 간단하게 해볼 수 있나 해서요.