Successfully display 1 to 10 number without using for ,while , do while loop .
Hello frnds ,
I am a newbie in zoho creator.yesterday was my tough time in office when i saw we cant use for,while,do while looping statement then how to display 1 to 10 or more number in successor. My friend Nitin ,who works in webners ( http://www.webnersolutions.com/ ) help me in this.I am sharing a code of snippet with all of you.
Function Name : makePageNumberList
------------------------------------------------------------------------------------------------------------------------------------------------------------------
list makePageNumberList(int counter, int pageNumber, list:int mylist)
{
if (input.counter < input.pageNumber)
{
input.counter = (input.counter + 1);
input.mylist.add(input.counter);
thisapp.makePageNumberList(input.counter, input.pageNumber, input.mylist);
}
return input.mylist;
}
===================================================================================
//Set variable :
initial_list = {1};
pageCount=10;
//Calling Function :
thisapp.makePageNumberList(1, pageCount, initial_list);
//In return
{1,2,3,4,5,6,7,8,9,10}