커뮤니티

2개 수식이 다른 결과가 나옵니다. 도와주세요

프로필 이미지
끼야98
2024-04-17 17:48:24
781
글번호 178680
답변완료
안녕하세요! 아래 A,B가 결과가 다르게 나오는 이유가 뭘까요? B식이 오류로 판단됩니다. 로그로 찍어보면 선언이 0으로 시작되는데도 처음부터 끝까지 1로 나옵니다. 3가지 조건이 모두 만족되지 않아도 1로 찍히네요, T가 3가지 조건이 만족한 곳만 1로 찍히게 하고 싶은데 안됩니다. 도와주세요 미리 감사드립니다. A식 if Condition1==true and Condition2==true and Condition3==true Then plot1(mavmav,"이평",Red); Else plot1(mavmav,"이평",Blue); B식 if Condition1==true and Condition2==true and Condition3==true Then T=1; if T==1 Then plot1(mavmav,"이평",Red); Else plot1(mavmav,"이평",Blue);
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2024-04-18 09:30:05

안녕하세요 예스스탁입니다. If Condition1==true and Condition2==true and Condition3==true Then T = 1; plot1(T); T값을 지표로 그려보시면 최초 조건만족하면 계속 T는 1인 것을 보실수 있습니다. 변수는 값이 한번 저장되면 해당값을 변경시 까지 유지합니다. If Condition1==true and Condition2==true and Condition3==true Then T = 1; else T = 0; plot1(T); 조건이 만족하면 1을 할당했다면 만족하지 않을때는 0과 같이 다른값으로 변경해 주셔야 합니다. if Condition1==true and Condition2==true and Condition3==true Then T = 1; else T = 0; if T==1 Then plot1(mavmav,"이평",Red); Else plot1(mavmav,"이평",Blue); 즐거운 하루되세요 > 끼야98 님이 쓴 글입니다. > 제목 : 2개 수식이 다른 결과가 나옵니다. 도와주세요 > 안녕하세요! 아래 A,B가 결과가 다르게 나오는 이유가 뭘까요? B식이 오류로 판단됩니다. 로그로 찍어보면 선언이 0으로 시작되는데도 처음부터 끝까지 1로 나옵니다. 3가지 조건이 모두 만족되지 않아도 1로 찍히네요, T가 3가지 조건이 만족한 곳만 1로 찍히게 하고 싶은데 안됩니다. 도와주세요 미리 감사드립니다. A식 if Condition1==true and Condition2==true and Condition3==true Then plot1(mavmav,"이평",Red); Else plot1(mavmav,"이평",Blue); B식 if Condition1==true and Condition2==true and Condition3==true Then T=1; if T==1 Then plot1(mavmav,"이평",Red); Else plot1(mavmav,"이평",Blue);