Actually this instruction is not C# originated. I know it was present in at least Python before that. The easiest way is to use a static local variable holding the last returned result and continue from there during the next call.
Qt Code:
int getNextNatural(bool restart=false){ static int last = -1; if(restart) last = -1; return ++last; }To copy to clipboard, switch view to plain text mode
Bookmarks