Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use const for variables that are never modified #88

Merged
merged 1 commit into from
Jan 6, 2022

Conversation

adamu
Copy link
Contributor

@adamu adamu commented Dec 26, 2021

Hello!

I am learning Zig via these Ziglings so apologies is this is a bad call.

I noticed a few places where var is used for variables that are only assigned to once, so thought it would be better to use const in those cases.

I'm slowly running through the exercises so will update this PR as I find them until there's response 🙂

@adamu adamu changed the title use const for real_char that is never modified use const for variables that are never modified Dec 26, 2021
@adamu
Copy link
Contributor Author

adamu commented Jan 2, 2022

I've finished the ziglings. They were great fun, thanks for the entertaining introduction to the language! This is all the vars I found that could be consts, but I'm sure there are others.

@ratfactor
Copy link
Owner

@adamu Yeah, good idea. Thanks for this!

@ratfactor ratfactor merged commit 0efa4c1 into ratfactor:main Jan 6, 2022
@adamu adamu deleted the const branch January 7, 2022 01:20
vamega pushed a commit to vamega/ziglings that referenced this pull request Jul 25, 2023
use const for variables that are never modified
dasimmet pushed a commit to dasimmet/ziglings that referenced this pull request May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants