fmt.Scanln(&var) to scan from stdin
I browsed some of the submissions of others, but they seem to use “bufio” instead of “fmt” to read input. I have little knowledge of the difference at the moment. Maybe I can check that tmr, I don’t think it’s very important for a newbie like me tho.
It’s been a while since I began learning Rust and Go. Of course, I’m not at the level that I can get a full-time position with them, but I find it interesting that programming languages try to address issues in very different ways.
Go language provides a tool by default to format code automatically,
whereas I need to install third-party libraries such as
flake8
or black
to format Python code.
From my understanding, Python programmers are treated like adults; we can do anything we want, but when writing Go, I feel that I’m always supervised (maybe I’m just not good enough).
- Each value in Rust has an owner.
- There can only be one owner at a time.
- When the owner goes out of scope, the value will be dropped.
With those rules, memory is managed by system safely. In Python, Garbage Collection will deal with memory but it’s not performance efficient. In C, memory needs to be managed explicitly by users. So, at first glance the rules are intimidating, but now not only it does make sense but also I’m impressed how the issues with memory management is addressed in Rust. I’m not that familiar tho.