In my app, I have 8 screens through which users can scroll to see all kinds of statistics. I have all made this in the same view, and made separate functions for each screen.
In order to select the right view, I have a variable that sets the current page and with the Up and Down button the counter will increase or decrease.
But then I get to the following code, which I was wondering if it can be done more efficiently or at least with fewer lines of code. Does anyone have a smart suggestion?
if (var pageNumber == 1) {
screen1(dc);
}
else if (var pageNumber ==2) {
screen2(dc);
}
etc... until pageNumber == 8.