I was talking to some people about a c-like featur...
# kontributors
a
I was talking to some people about a c-like feature that could be pretty convenient and useful, but I don't wanna add it cause I wouldn't know how to do it for say, there would be a cheap and easy way of doing it but it'd take longer for the compiler to do it all but anyways it's a new kind of for loop where if you have a for loop like
for(int i = 0; i < 100; i++){ arr[i] = 0; }
or something like that varied for whatever language (in this case kotlin syntax) and you just have this for loop iterating for that one statement. Why not clean up the code a bit and make it all just one line, no body, no scopes, etc. So my friends and I agree on something like this:
Copy code
for(0 <= i <= 100; arr[i] = 0); //implicit type for iterator variable
for(0 < (int i) <= 100; arr[i] = 0); //explicit type for iterator variable
What do you guys think about this being a feature in kotlin? It'd be cleaner to write, it's not gonna speed up the compiler or clear up memory, it'd just be a user preference that could make large projects easier to read.