File: expressions-lambda.vala

package info (click to toggle)
vala 0.3.4-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 13,756 kB
  • ctags: 12,353
  • sloc: ansic: 116,516; sh: 9,897; yacc: 1,218; makefile: 837; xml: 657; lex: 285
file content (21 lines) | stat: -rw-r--r-- 392 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using GLib;

static delegate int Maman.ActionCallback (int i);

class Maman.Bar : Object {
	static int do_action (ActionCallback cb) {
		return cb (1);
	}

	static int main (string[] args) {
		stdout.printf ("Lambda Test: 1");
		
		stdout.printf (" %d", do_action (i => i * 2));
		
		stdout.printf (" %d", do_action (i => { return i * 3; }));
		
		stdout.printf (" 4\n");
		
		return 0;
	}
}