3 ms·
I can see pros and cons for either but what about int i,j,k; I think that's clearer with type first.
by zwieback 8y ago
I can see pros and cons for either but what about
int i,j,k;
I think that's clearer with type first.
- weberc2 8y agoi,j,k int Seems fine to me either way
- nicoburns 8y agoI think let i,j,k : int; is pretty clear. Although I'm not convinced that declaring multiple variables like this should be allowed at all. Imo it's clearer to declare them seperately when they're used. For example: for (let i in 0..n) { for (let j in 0..i) { // do stuff } }
- int_19h 8y agoIt's not so much that it's clearer, it's that it reads more naturally in English: "integer i" is very much akin to, say, "president Lincoln". Which is probably why it was adopted first. I suspect it's also why the colon is often used when the order is reversed, even when it's not strictly necessary to disambiguate parsing - you want something that reads "i is integer", and colon already kinda sorta has that meaning.