using arrayName.size is not advisable anywhere else other than in CoDScript because in other languages arrays are created with a fixed size. The 'proper' way to populate an array would therefore be:
Code: Select all
for(i=0;i<21;i++)
array[i] = i;
Moderator: Core Staff
Code: Select all
for(i=0;i<21;i++)
array[i] = i;
Ryan wrote:i dont understand that array stuff at all... why do you put example = []; and why do you write example[example.size] = i
i dont get that "i" in every script why is it always "i" and not "a" or "codjumperkickzassbitchlol"
and why print "example" and not "example.size" whats the difference...
there are so many things i dont get i cannot explain cos its like so weird... all these names string variable loop i only type these into my dictionary and it gives me the words but to understand them is so difficult i cant explain it man...
Code: Select all
for( x = 0; x < example.size; x++) // here you can see you can use anything you want, instead of x or i or DeadOsamaBinLaden, it really doesn't matter.
{
IPrintLnBold( example[x] );
}
I think the stuff standing above is correct. If not come to my house and beat the living shit out of me. Or just correct me here.text to show
more text
Code: Select all
for(counter=0 ; counter<box_of_cards.size ; counter++)
iprintln("The first card is: " + box_of_cards[counter]);
Code: Select all
array = [];
for(i = 0; i < 30; i++)
array[i] = randomInt(10);
je pense, que non...megazor wrote:what you know for now is enough to solve that.
Code: Select all
if(i%5==0)
{
iprintln(array[i]);
}
Code: Select all
array = [];
for(i = 0; i < 30; i++)
array[i] = randomInt(10);
if(i%5==0 && i!=0 || 5);
{
return i;
}
Code: Select all
main() //start of every program
{
result = sumOf(3, 5);
}
sumOf(x, y) //our custom function
{
sum = x+y;
return sum;
}
Code: Select all
array = []
for(i=0;i<30;i++)
    array[i] = randomInt(10);
counter = 0;
for(i=0;i<array.size;i++)
    if(array[i]==5) counter++;
iprintln(counter);
Users browsing this forum: No registered users and 0 guests