I want to print the pyramid star, but i cant able to print. The value of i is increase when comparing to j

I want to print the pyramid star, but i cant able to print. The value of i is increase when comparing to j

void star()
{
fruits={"mango","apple","banana","pineapple","watermelon","pomograned"};
i=0;
j=0;
for each rec in fruits
{
if(i<4)
{
for each rec in fruits
{
if(j<=i)
{
info "*";
j=j+1;
}
}
i=i+1;
info "\n";
}
}
}