using System;
namespace functions_out
{
class Class1
{
static void Main(string[] args)
{
int x = 5, y = 10, z = 15;
Console.WriteLine("befor x = {0}, y = {1}, z = {2}", x, y, z);
// befor x = 5, y = 10, z = 15
f(x, out y, out z);
Console.WriteLine("after x = {0}, y = {1}, z = {2}", x, y, z);
// after x = 5, y = 105, z = 405
y = f(out x, y, out z);
Console.WriteLine("x = {0}, y = {1}, z = {2}", x, y, z);
// x = 1, y = 2, z = 3
}
static void f(int x, out int y, out int z)
{
y = x + 100;
z = x + 400;
x = 1000;
}
static int f(out int x, int y, out int z)
{
x = 1;
y = 2;
z = 3;
return y;
}
}
}