I'm a Python programmer learning C++. In Python, parameters are passed to functions as copies (assuming that parameters are non-mutable). This means that the original values of parameters are not local to stuff happening inside the function and therefore can't be changed.
In this following C++ snippet, I see that this function takes in a reference of s, which, if edited inside the function, can change the original value of s. I don't understand why this is the convention, aka. why &s is used instead of s.
void write_comment(const std::string &s) {
std::cout << s << std::endl;
}