@HootinNHollerin@lemmy.dbzer0.com to Engineering Memes@lemmy.worldEnglish • edit-23 months agoGet Datedlemmy.dbzer0.comimagemessage-square54fedilinkarrow-up1676arrow-down112
arrow-up1664arrow-down1imageGet Datedlemmy.dbzer0.com@HootinNHollerin@lemmy.dbzer0.com to Engineering Memes@lemmy.worldEnglish • edit-23 months agomessage-square54fedilink
minus-square@tetris11@lemmy.mllinkfedilinkEnglish2•edit-23 months agofunction validate(val) try: cast val as numeric except: print "Oops, not a number" cast val as general ## date or whatever end validate(12.5) ## returns 12.5 validate("12.5") ## returns 12.5 validate("12 . 5") ## returns a date maybe
minus-square@PoolloverNathan@programming.devlinkfedilinkEnglish3•edit-23 months agoOh my god what cursed Python, Lua, and SQL offshoot is this
function validate(val) try: cast val as numeric except: print "Oops, not a number" cast val as general ## date or whatever end validate(12.5) ## returns 12.5 validate("12.5") ## returns 12.5 validate("12 . 5") ## returns a date maybe
Oh my god what cursed Python, Lua, and SQL offshoot is this
It’s my own grammar, “Luanatic”