Re: [Vala] Suggestion: first {} and last {} operators in iteration-loops



/* With first{} and last{} */
static int main (string[] args) {

        foreach (string arg in args) {
                    stdout.printf("%s is a string", arg);
                    first {
                         stdout.printf("%s is the first string", arg);
                    }
                    last {
                         stdout.printf("%s is the last string", arg);
                    }
           }
           return 0;
}

With this syntax, is stdout.printf("%s is a string", arg); also run on
the first and last elements?  What happens if args is 1 element long,
so the first element is the last element - do all three printfs get
called?



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]