3 ms·
It's called a procedural language for a reason :) Something that doesn't return a value shouldn't be called a "function", that's just a C-ism. And curly braces
by rep_lodsb 4y ago
It's called a procedural language for a reason :)
Something that doesn't return a value shouldn't be called a "function", that's just a C-ism. And curly braces are ugly!
</troll>
Integers, enums and chars are all so-called "ordinal" types. They have consecutive values with a lower and upper bound, that's why they can all be used as array indexes or in sets (floating-point numbers can't, nor could enums with gaps, if they existed).
Ranges aren't used just for array bounds. I think it's really elegant how the usual "0 .. len-1" is actually an anonymous subtype of integer, not some special syntax for declaring arrays.
- Zickzack 4y ago> Something that doesn't return a value shouldn't be called a "function", that's just a C-ism. Something that does not seem to return a value returns in fact a value of the type void which is empty. The idea comes from Algol 68 and has been a contribution by a certain John McCarthy.
- mananaysiempre 4y agoAhh I finally get why C calls the unit / top type “void”—it’s empty as in requires no storage! (It’s not the usual empty / bottom / contradiction type, which has an empty set of possible values and would imply the function does not return at all.)