ratfactor / ziglings

Learn the Zig programming language by fixing tiny broken programs.
MIT License
4.3k stars 481 forks source link

Ex 003 "i" comment missing #75

Closed hdcos closed 2 years ago

hdcos commented 2 years ago
//
// It seems we got a little carried away making everything "const u8"!
//
//     "const" values cannot change.
//     "u"     types are "unsigned" and cannot store negative values.
//     "8"     means the type is 8 bits in size.

we could add

//
// It seems we got a little carried away making everything "const u8"!
//
//     "const" values cannot change.
//     "u"     types are "unsigned" and cannot store negative values.
//=>=> "i"     types are "signed" and can store negative values.
//     "8"     means the type is 8 bits in size.
ratfactor commented 2 years ago

@hdcos Hmmm... well, the intent there was just to decode "const u8". Do you think there would be a way to make that clearer?

aedrax commented 2 years ago

I think the i is not relevant for this description since the comment is just describing the dissection of const u8 and not providing an exhaustive list of types. Though another lesson showing more types may be a useful addition

ratfactor commented 2 years ago

@hdcos I'm going to go ahead and close this now, but please do comment/re-open/make a new one if you think there's a good place to add info about signed integers. Thanks!