Jump to content
Sign in to follow this  
GodForsakenSoul

a question that always bugged me

Recommended Posts

GodForsakenSoul

func genericfunction($something1, $something2, $something3)

i saw people put variables in the () things. (i don't know how they are called XDD)

i never understood WHY. what does it do?

please explain it as if i'm retarded ._.

Share this post


Link to post
Share on other sites
99ojo

Hi,

These are parameters parsed to the function and use them in beetween the function.

Maybe this is understandable:

_mymsgbox ("Title", "Message")

Func _mymsgbox ($title, $message)
    MsgBox (0, $title, $message)
EndFunc

;-))

Stefan

Share this post


Link to post
Share on other sites
GodForsakenSoul

slightly... yes... but could you give a less abstract example?

Share this post


Link to post
Share on other sites
Juvigy

_mymsgbox ("First", "Example")
_mymsgbox ("Second", "Example")
_mymsgbox ("", "Is it more clear now?")

Func _mymsgbox ($title, $message)
    MsgBox (0, $title, $message)
EndFunc

Edited by Juvigy

Share this post


Link to post
Share on other sites
GodForsakenSoul

...

holy @#!%

i learn this NOW?!?!?! ;)

dear god, dude, i love you!

Share this post


Link to post
Share on other sites
99ojo

slightly... yes... but could you give a less abstract example?

Hi,

maybe:

$a = 5
$b = Random (1, 10, 1)

If $a < $b Then
    _mymsgbox ("Smaller", $a & " is smaller then " & $b)
ElseIf $a > $b
    _mymsgbox ("Bigger", $a & " is bigger then " & $b)
Else
    _mymsgbox ("Equal", $a & " equals " & $b)
EndIf

Func _mymsgbox ($title, $message)
    MsgBox (0, $title, $message)
EndFunc

;-))

Stefan

P.S: Too late, Juvigy has had a less abstract and hopefully now understandable ....

Share this post


Link to post
Share on other sites
GodForsakenSoul

Troll Posted Image

why troll? i'm serious. :evil:

this is literally the first time i understand this concept.

@Manadar: it defines the size of the array. $array[3] has 3 spots of data.

however, spot #1 is actually $array[0]. so think in -1s

waaaaaaait a minute...... ;)

Edited by GodForsakenSoul

Share this post


Link to post
Share on other sites
James

why troll? i'm serious. :evil:

this is literally the first time i understand this concept.

@Manadar: it defines the size of the array. $array[3] has 3 spots of data.

however, spot #1 is actually $array[0]. so think in -1s

waaaaaaait a minute...... ;)

How the fuck do you understand arrays like that but not function parameters Posted Image

Share this post


Link to post
Share on other sites
GodForsakenSoul

look, i'm special allright?

mommy said so. ;)

Share this post


Link to post
Share on other sites
jvanegmond

waaaaaaait a minute...... ;)

waaaaaaait a minute...... :evil:

Haha brilliant.

Share this post


Link to post
Share on other sites
GodForsakenSoul

i have my moments. ;)

Share this post


Link to post
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
Sign in to follow this  

×