Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test-decl-expr-01.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 880d3344585a87c342b090cb2fef7e07f4497fd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System;

class DeclarationExpression
{
	public static int Main ()
	{
		Out (out int o);
		if (o != 3)
			return 1;

		if (Out (out int o1)) {
			if (o1 != 3)
				return 2;
		}

		Out (out var o3);
		if (o3 != 3)
			return 4;

		Out2 (str: "b", v: out var o5);
		if (o5 != 9)
			return 7;

		Console.WriteLine ("ok");
		return 0;
	}

	static bool Out (out int value)
	{
		value = 3;
		return true;
	}

	static bool Out2 (out int v, string str)
	{
		v = 9;
		return true;
	}
}