Change var
to const
in some exercises
#329
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As explained in #324 , I changed some variable declaration to constants. I also tried to update the comments when it made sense.
Some variable could be changed to constant like
num1
here in039_pointers.zig
but it would require to also changenum1_pointer
to be*const u8
.ziglings/exercises/039_pointers.zig
Lines 25 to 36 in 08e8a0f
Since this exercise is trying to explain how pointers works I assumed it would not be a good idea to make the change. The same applies to exercise
066_comptime.zig
and after, where we already make use of const and comptime.I also understand that changing variables to constants may give away the answer to some exercise. Feel free to not merge some changes to some exercises if you think it's not worth it.
Everything was built and run with
zig 0.11.0-dev.3747
NB: I also updated outdated comments referencing the change in builtin casts as I forgot to check those in my previous PR. (see: #327)