Raised This Month: $ Target: $400
 0% 

custom functions


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LearninG
Senior Member
Join Date: Apr 2019
Location: Iran
Old 08-20-2019 , 14:17   custom functions
Reply With Quote #1

Hi,
I almost every time create custom functions in two ways :
1- function()
2- function(id)
Basically I don't know what to add in "()" I would be thankful if someone tell me some examples of custom functions with different "()"
and explain me what does "()" do exactly in functions.
Thanks.

Last edited by LearninG; 08-20-2019 at 14:19.
LearninG is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 08-20-2019 , 14:23   Re: custom functions
Reply With Quote #2

There's no 'two ways', there's just different parameters. You add in () what you pass when calling it.
__________________
edon1337 is offline
LearninG
Senior Member
Join Date: Apr 2019
Location: Iran
Old 08-20-2019 , 14:38   Re: custom functions
Reply With Quote #3

Quote:
Originally Posted by edon1337 View Post
There's no 'two ways', there's just different parameters. You add in () what you pass when calling it.
I know , but that's how i create custom functions.

what type of values can i add into "()" , and how to use them in function ?

does this example works ?
PHP Code:
public some_func(variable1 variable2)
{
    
variable1 random_num(5,15)
    
variable2 variable1 10
    
    
if (variable1 10)
    {
        return 
variable2
    
}

LearninG is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 08-20-2019 , 14:46   Re: custom functions
Reply With Quote #4

Quote:
Originally Posted by LearninG View Post
what type of values can i add into "()"
Any.

Quote:
Originally Posted by LearninG View Post
how to use them in function ?
The way it's meant to be used.

Quote:
Originally Posted by LearninG View Post
does this example works ?
PHP Code:
public some_func(variable1 variable2)
{
    
variable1 random_num(5,15)
    
variable2 variable1 10
    
    
if (variable1 10)
    {
        return 
variable2
    
}

If you mean compile, then it should, but I don't know what way you're expecting it to work, it takes 2 values, then assigns a random number in-between 5 and 15 to the first variable, then increases then second variable by 10, then it checks whether variable1 (the random number) is smaller than 10 and returns variable 2 if true.
__________________
edon1337 is offline
thEsp
BANNED
Join Date: Aug 2017
Old 08-20-2019 , 14:45   Re: custom functions
Reply With Quote #5

Any kind. But I suggest you to read this wiki first.
thEsp is offline
LearninG
Senior Member
Join Date: Apr 2019
Location: Iran
Old 08-20-2019 , 15:05   Re: custom functions
Reply With Quote #6

thanks , now i will personally do some tests to experience of how it works.
LearninG is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:26.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode