|
|
이전 주제 보기 :: 다음 주제 보기 |
글쓴이 |
메시지 |
abebe
가입: 2023년 3월 15일 올린 글: 4
|
올려짐: 2023년4월4일 20:03 주제: [HW3] Question on LESS operation |
|
|
Hello,
"두 값의 대소를 비교할 경우 둘 다 정수 값이 아니면 타입 에러입니다."
I saw the above statement in the additional description for HW3 and I couldn't understand what it means.
Does it mean if two values (at least one not int) are compared with operator LESS, we should raise type error?
Thank you,
Dawit F. Amanu |
|
위로 |
|
|
김도형
가입: 2022년 3월 8일 올린 글: 103
|
올려짐: 2023년4월5일 11:16 주제: |
|
|
Hello.
Answer for this question is Yes, and you must consider the difference between EQUAL and LESS to understand.
We know that 1 and true aren't same, but we can't define which one is bigger.
This is because comparing operator is a kind of method defined in one type, and cannot be used to elements outside that type set - unless it is expanded.
(To understand more, I recommend you search for order in set theory.)
Hence, in K--, 1 EQUAL true makes the result value 'false', but comparing by LESS makes type error, making no result value. |
|
위로 |
|
|
|
|
새로운 주제를 올릴 수 없습니다 답글을 올릴 수 없습니다 주제를 수정할 수 없습니다 올린 글을 삭제할 수 없습니다 투표를 할 수 없습니다
|
Powered by phpBB 2.0.21-7 (Debian) © 2001, 2005 phpBB Group Translated by kss & drssay
|