step-version: func [ val [tuple!] segment [word!] "'major, 'minor, or 'build" /local res ][ switch segment [ build [res: val + 0.0.1] minor [res: val + 0.1.0 res/3: 0] major [res: val + 1.0.0 res/2: 0 res/3: 0] ] either res > val [res] [none] ] can-step-version?: func [ val [tuple!] segment [word!] "'major, 'minor, or 'build" ][ either step-version val segment [true] [false] ] ; foreach val [ ; 0.0.0 0.0.255 ; 0.1.0 0.255.0 0.255.255 ; 1.0.0 0.255.255 ; 254.255.255 255.255.254 ; 255.254.255 254.255.255 ; ][ ; foreach seg [build minor major] [ ; print [val tab seg tab can-step-version? val seg tab attempt [step-version val seg]] ; ] ; ] ; print attempt [step-version 254.255.255 'test] ; halt
You need to create an account or log in to post comments to this site.