Thanks for the development work on this - it has solved a few headaches already for me!
I have a quick question about division. I noticed in PICBasic you can divide with n/2 and get the remainder with n//8. n//8 doesn't seem to work in GCBasic and I couldn't see and Math/Maths function lists. I could really do with getting this remainder thing working - is there a way of doing this? Alternatively I could do something hairy like: n-8*int(n/8) but get an error doing this too.
Sorry for the noob question but I'm not really used to low level programming.
Thanks in advance,
Dave
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
will return the remainder of SomeVar divided by 3. If you don't like using the % sign, you can use MOD as is the case in QBASIC/FreeBASIC.
Unfortunately I've not updated the online help file since the last major release this time last year, so if you're using update.zip the help will not be quite up to date. There is a page at http://gcbasic.sourceforge.net/update.html which lists the changes/new features, but that didn't exist until a few months after the % operator and so doesn't list it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the development work on this - it has solved a few headaches already for me!
I have a quick question about division. I noticed in PICBasic you can divide with n/2 and get the remainder with n//8. n//8 doesn't seem to work in GCBasic and I couldn't see and Math/Maths function lists. I could really do with getting this remainder thing working - is there a way of doing this? Alternatively I could do something hairy like: n-8*int(n/8) but get an error doing this too.
Sorry for the noob question but I'm not really used to low level programming.
Thanks in advance,
Dave
Use the % operator. For example,
Temp = SomeVar % 3
will return the remainder of SomeVar divided by 3. If you don't like using the % sign, you can use MOD as is the case in QBASIC/FreeBASIC.
Unfortunately I've not updated the online help file since the last major release this time last year, so if you're using update.zip the help will not be quite up to date. There is a page at http://gcbasic.sourceforge.net/update.html which lists the changes/new features, but that didn't exist until a few months after the % operator and so doesn't list it.
OK. Thanks so much for the quick reply!