2 | let x = (let y = 6);
| ^^^
The let y = 6 statement does not return a value, so there isn’t anything for x to bind to. This is different from what happens in other languages, such as C and Ruby, where the assignment returns the value of the assignment. In those languages, you can write x = y = 6 and have both x and y have the value 6; that is not the case in Rust.
이 부분말인데
C도 int x = (int y = 6); 하면 안 되잖아
rust 도 let mut y = 0; let x = y = 6; 할 수 있는데 저렇게 표현해놓은 이유가 머임?
어 머냐 저렇게하면 컴파일되긴 하는데 y 는 i32고 x는 () 타입으로 뜨는데 이게 뭔타입임?
The () type, sometimes called "unit" or "nil". 라는데 그럼 지금 내가 장소삼포인터 만든거?
걍 빈 튜플이었네
그치 let y=6은 return하는게 없잖아
뭐가 문제인지 이해가 잘 안가는데 좀 더 상세히 말해줄 수 있음?
그냥 내가 뻘짓한거였음
Rust에서 대입문은 () 타입임
let은 선언문이라 아얘 표현식으로 처리안되고
ㅇㅇ.. 나는 컴파일되길래 x에 6이 대입되는줄 알고 흥분했던건데 사태파악후 침착해졌음