Spin equivalent of PBASIC's DIG operator
SSteve
Posts: 808
Looking through the Spin documentation, I don't see an equivalent for the PBASIC "DIG" operator. Is this the closest thing for "theDigit = value DIG 1"?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
OS-X: because making Unix user-friendly was easier than debugging Windows
Post Edited (SSteve) : 5/14/2006 2:14:07 AM GMT
theDigit := (value / 10) // 10
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
OS-X: because making Unix user-friendly was easier than debugging Windows
Post Edited (SSteve) : 5/14/2006 2:14:07 AM GMT
Comments
PUB dig(value, position) : digit
· if postion > 0
··· repeat position
····· value /= 10
· digit := value // 10
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
'REPEAT <count>' where count==0 won't repeat anything. So, you don't need that test for >0. I'll get rid of that line:
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chip Gracey
Parallax, Inc.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax