3 ms·
Keep in mind that Nimrod will also try to evaluate normal code at compile-time, so the following will work fine: const FOOBAR = if 2 > 1: 10 else: 20
by dom96 12y ago
Keep in mind that Nimrod will also try to evaluate normal code at compile-time, so the following will work fine:
const FOOBAR = if 2 > 1: 10 else: 20
- Symmetry 12y agoWhat I'd actually be doing is more like: when ROBOT_VER == 32: type TSonarAddresses = array[0..3, int] const sonarAddresses: TSonarAddresses = [1,2,3,4] ... elif ROBOT_VER == 33: ... and stuff like that.
- dom96 12y agoI see. Good, that is precisely what 'when' should be used for :)
- rurban 12y agoThis is called "constant folding", and every better compiler should do that.