Jump to content

_Mod Problem


Recommended Posts

I came across this and i thought this would work, but it didn't =O. :)

Any idea what's wrong

Global $Number=5
If _Mod() Then
    MsgBox(64,"","Success")
Else
    MsgBox(64,"","Failed")
EndIf
Func _Mod()
    Local $Round
    If IsInt(Round($Round=$Number/2)) Then
        Return True
    Else
        Return False
    EndIf
EndFunc

Edit: A simple math question, thanks in advance.

Edited by Generator
Link to comment
Share on other sites

I wonder if you clicked my link ... because that is NOT an UDF but a function already implemented in AutoIt and it does the same thing you're looking for.

I did look at your link but then round wouldn't work. It rounds up not round to decimal.
Link to comment
Share on other sites

I'm confused why would you need Round?

If the result of Mod is 0 then the first number is divisible by the second.

Global $Number=5
If Mod($Number, 2) = 0 Then
    MsgBox(64,"","Success")
Else
    MsgBox(64,"","Failed")
EndIf

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...