SA-MP Forums Archive
Is there a diffrence? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Is there a diffrence? (/showthread.php?tid=371357)



Is there a diffrence? - Dan. - 23.08.2012

In every script I see the format line like this:
pawn Код:
format(string, sizeof(string), "Hello %s", name);
But I saw this in a script, and it's easier to write it like this:
pawn Код:
format(string, sizeof string, "Hello %s", name);
So is there any diffrence at all?


Re: Is there a diffrence? - ThePhenix - 23.08.2012

I think you should add the (string)

Before type it must be a variable like:

pawn Код:
new string[128]



Re: Is there a diffrence? - Wesley221 - 23.08.2012

There isnt any difference between both. The only thing is what you can do with the ( ), you can count multiple things together. Like 'sizeof ( VarA + VarB )'
I myself always use the non brackets one, since its way easier ^^


Re : Is there a diffrence? - Eony - 23.08.2012

The parentheses are optional when having a single argument, and no maths inside. The compiler reads that differently, but the result is the same. It's simply a readability matter.