Why Do we Use Loops?
#1

Hello There, My Question is Why Do we Use Loops In a Code? For Example This Code:
pawn Код:
stock ShowInventory(playerid)
{
    new iteminv[20];//20 item 0->19
    for(new i = 0; i < 20;i++)// Get all form 0 to 19
    {
    iteminv[i] = InvInfo[playerid][iSlot][i];// Check item in slot
    if(InvInfo[playerid][iSlot][i] == 0) // if slot i no have item . it will return model '!'
    {
    iteminv[i] = 1239;// 1239 is model '!'
    }
   
    }
    ShowModelSelectionMenuEx(playerid, iteminv,20, "Inventory",INVENTORY_MENU, 0.0, 0.0,0.0);//mSelection
    return 1;
}
So, If now you must have read the Above Code.. So Some Explanation please?
Well... I'm Confused In This thing
pawn Код:
{
    iteminv[i] = InvInfo[playerid][iSlot][i];// Check item in slot
    if(InvInfo[playerid][iSlot][i] == 0) // if slot i no have item . it will return model '!'
    {
Here Why Do we Have put [i] After [iSlot]..
These are My Questions...
Reply
#2

Well Thanx ****** i Now Understood That Why Do We Use Loop.. But Why We Had Used [i] After [iSlot]
pawn Код:
{
    iteminv[i] = InvInfo[playerid][iSlot][i];// Check item in slot
    if(InvInfo[playerid][iSlot][i] == 0) // if slot i no have item . it will return model '!'
    {
Reply
#3

Okay Understood Thanx
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)