Yes, you can. You’d just need to have a look at the datatype and format System.version() returns and use that.
But the common way would be to do that via compiler directives so that non-applicable code won’t even be compiled into the binary.
e.g.
#if (SYSTEM_VERSION == 0x01050000)
// code only for this version
#endif
@ScruffR thanks is there a way to compare the System_version? I’d like all versions less than 1.5.0 run a little differnetly because of the new Sleep2.0 and PMIC overide setting.
It should - why not just try?
However I’d rather go with < 0x01050000 to activate sleep 1.0 as you don’t know what future versions will bring, but you know what previous and current versions do.