fix typo
@unional Hmmm... I'm more used to seeing "reference to".
It's not a formal survey, but I see these stats when searching stackoverflow.com:
"reference to" 352,609 results
"reference of" 35,780 results
I tend to strong associate "to" with pointers as well - "pointer to" instead of "pointer of".
Change my mind! :-)
I see. :)
When I read Let's pass a reference to num to our function... it just look weird and have to stop and rethink what it means.
When I try Let's pass a reference of num to our function... then it clicks as (reference of num) can be substituted with the reference, i.e. Let's pass "the reference" to our function.
When using reference to num, it focus on the relationship, i.e. that is the reference to something, instead of emphasize on the reference itself.
It is relatively minor and maybe you can leave it as is. 🍻
@unional Oh, thank you! Yes, I see what you mean. Using "to" twice in Let's pass a reference to num to our function... is not good. Let's find a way to re-word that sentence entirely to avoid the confusion!
How about we change:
// Let's pass a reference to num to our function and print it:
by removing "to our function" entirely:
// Let's pass a reference to num, then print the result:
What do you think?
How about even skip the latter part? It describes the next two lines, but what's really important is just the first line. This is the same for the next comment.
i.e. update that section to:
// Let's pass a reference to num:
makeFive(&num);
std.debug.print("num: {}, ", .{num});
// Now something interesting. Let's pass a reference to a
// specific array value:
makeFive(&more_nums[2]);
// [also remove this comment, doesn't add anything to the exercise (pass by reference)]
std.debug.print("more_nums: ", .{});
for (more_nums) |n| {
std.debug.print("{} ", .{n});
}
🍺
How about we change: ... by removing "to our function" entirely:
// Let's pass a reference to num, then print the result:
My suggestion would be:
Let's pass the num reference to our function and print it: