variables

Discussions about Coding and Scripting

variables

Postby Rakiayn » Tue Apr 24, 2012 7:45 pm

I know variables are defined like this:

local int var1;

but I sometimes see this:

local int var1, var2;

Anyone can tell me what use this has?
User avatar
Rakiayn
Masterful
 
Posts: 512
Joined: Fri Aug 28, 2009 3:33 pm

Re: variables

Postby Feralidragon » Tue Apr 24, 2012 7:48 pm

In the first one you are declaring 1 local variable of the type "int".
In the second one you are declaring 2 local variables of the type "int".

So basically the usage is to declare more than 1 variable of the same type.

Quick example:
Code: Select all
local int var1;
local int var2;
local int var3;
local string var4;
local string var5;


Can also be declared as:
Code: Select all
local int var1, var2, var3;
local string var4, var5;
User avatar
Feralidragon
Site Staff
 
Posts: 3708
Joined: Wed Feb 27, 2008 6:24 pm
Location: Portugal - Lisbon
Personal rank: The Unreal Boy

Re: variables

Postby Rakiayn » Tue Apr 24, 2012 7:53 pm

thats it?
lol I thought it was something more complex
User avatar
Rakiayn
Masterful
 
Posts: 512
Joined: Fri Aug 28, 2009 3:33 pm

Re: variables

Postby JackGriffin » Tue Apr 24, 2012 9:33 pm

It is, he's not telling you the 'secret' stuff. That costs extra :)
/away for now.
JackGriffin
Godlike
 
Posts: 1732
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: Retired as of Sep-11


Return to Coding, Scripting

Who is online

Users browsing this forum: No registered users and 1 guest

cron