Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
for tomsen
#1
Code:
setshit()
{
self.derp = [];
self.derp[0] = 1;
self.derp[1] = 2;
self.derp[2] = 3;
self.derp[3] = 4;
self.derp[4] = 5;
self.derp[5] = 6;
self.derp[6] = 7;
}

isintinarray(array,number)
{
for(i=0;i<array.size;i++)
{
if(array[i] == number)
{
return true;
}
}
}

randomfunc()
{
if(isintinarray(self.derp,6))
iprintlnbold("is in ! :D");
}
Something like this? ;o


Now give me +rep for wasting 5 min of my life.


EDIT
apparently this is not what he wanted derp.

Code:
numberfunc(num1,num2)
{
if(num1 % num2 == 0)
return true;
else
return false;
}

use it as:
numberfunc(9,3); //will return true
numberfunc(10,3); //will return false
[Image: MaEIQ.png]
Reply

#2
Code:
isMultiplier( baseNum, number )
{
    if( int( number / baseNum ) == ( number / baseNum ) )
        return true;
        
    return false;
}

if( isMultiplier( 3, 15 ) )
{
    //do shizzle
}

this?
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

Reply

#3
(08-23-2011, 22:15)iAegle Wrote:
Code:
isMultiplier( baseNum, number )
{
    if( int( number / baseNum ) == ( number / baseNum ) )
        return true;
        
    return false;
}

if( isMultiplier( 3, 15 ) )
{
    //do shizzle
}

this?

the part I edited in my post does the same
[Image: MaEIQ.png]
Reply

#4
(08-23-2011, 22:16)Pozzuh Wrote:
(08-23-2011, 22:15)iAegle Wrote:
Code:
isMultiplier( baseNum, number )
{
    if( int( number / baseNum ) == ( number / baseNum ) )
        return true;
        
    return false;
}

if( isMultiplier( 3, 15 ) )
{
    //do shizzle
}

this?

the part I edited in my post does the same

k .. what does % do exactly?
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

Reply

#5
(08-23-2011, 22:18)iAegle Wrote:
(08-23-2011, 22:16)Pozzuh Wrote:
(08-23-2011, 22:15)iAegle Wrote:
Code:
isMultiplier( baseNum, number )
{
    if( int( number / baseNum ) == ( number / baseNum ) )
        return true;
        
    return false;
}

if( isMultiplier( 3, 15 ) )
{
    //do shizzle
}

this?

the part I edited in my post does the same

k .. what does % do exactly?

return the rest value... i've no idea if that's proper english but w/e you're dutch so you'll understand lol.

btw new version of the code (totally made by me Troll )
Code:
numberfunc(num1,num2)
{
    return(num1 % num2 == 0);
}

[Image: MaEIQ.png]
Reply

#6
I think you mean that if you do

21/3 you get 7 and if you do 7/3 your rest value is 7?
Reply

#7
(08-23-2011, 22:42)surtek Wrote: I think you mean that if you do

21/3 you get 7 and if you do 7/3 your rest value is 7?

nah 21/3 would return 0 because it is an int

22/3 would return 0.333333333333333333333333333
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

Reply

#8
% is the modulo operator

it returns the remainder after division

ex.
10 % 3 = 1
3 goes into 10, 3 times (9), then there is 1 left over

9 % 3 = 0
3 goes into 9, 3 times (9), with 0 left over at the end

Code:
is_even(num)
{
     return (num % 2 == 0);
}

EDIT: for better explanation: http://en.wikipedia.org/wiki/Modulo_operation
Reply

#9
^that, yes Smile
[Image: MaEIQ.png]
Reply

#10
guys. i already know that stuff^^
no need for making a thread xD
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.