Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
ArcherSam
15
Years of Service
User Offline
Joined: 13th Mar 2011
Location: Florida, US
Posted: 2nd Jun 2011 00:19
Hey,

How do you do modulus division in DarkBASIC?

Sam
BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 2nd Jun 2011 00:31
Try...

MOD



ArcherSam
15
Years of Service
User Offline
Joined: 13th Mar 2011
Location: Florida, US
Posted: 2nd Jun 2011 00:39 Edited at: 2nd Jun 2011 00:44
LOL, It was that easy. Thanks. I had tried: (5 % 2).

I unsure of the syntax for this command; I couldn't find it in the DBPro help file.
BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 2nd Jun 2011 00:48
I think it's missing from the help, and it doesn't highlight in the editor either.

For anyone else that comes across this, the syntax is:

x = 10 MOD 9

The result x being 1

ArcherSam
15
Years of Service
User Offline
Joined: 13th Mar 2011
Location: Florida, US
Posted: 2nd Jun 2011 00:51
Thanks! Wouldn't have figured that out for a minute. LOL.
Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 2nd Jun 2011 01:33
I also think that "float mod float" is valid as well.

Can someone check that the above works, and sets x# to .734?

Just remarking because in some other languages this isn't true.


Tell me if there's a broken link to images in a thread I post, and I'll fix 'em.
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 3rd Jun 2011 05:51
I can confirm that Neuro, it does work with floats.

enderleit
19
Years of Service
User Offline
Joined: 30th May 2007
Location: Denmark
Posted: 3rd Jun 2011 08:31
a = 5 %% 2
also works

Rich Dersheimer
AGK Developer
17
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 3rd Jun 2011 08:46
And it IS in the help, under principles/operators. Doesn't highlight as a command, or call it up when you hit F1 though.

ArcherSam
15
Years of Service
User Offline
Joined: 13th Mar 2011
Location: Florida, US
Posted: 3rd Jun 2011 19:44 Edited at: 3rd Jun 2011 19:45
Quote: "
And it IS in the help, under principles/operators. Doesn't highlight as a command, or call it up when you hit F1 though.
"


Found it!, didn't see that. Must have overlooked it. LOL. Thanks.

Login to post a reply

Server time is: 2026-07-10 22:54:24
Your offset time is: 2026-07-10 22:54:24