C# paiza 50 - 스코프
/// scope
//////
// スコープを理解しよう
using System;
public class Lesson06
{
public static void Main()
{
int a = 10;
int b = 20;
int num = Sum(a,b);
Console.WriteLine(num);
}
public static int Sum(int x, int y)
{
return x + y;
}
}
//////
///
// スコープを理解しよう
using System;
public class Lesson06
{
public static void Main()
{
int a = 10;
int b = 20;
int num = Sum(a,b);
Console.WriteLine(num);
}
public static int Sum(int x, int y)
{
int a = 3;
Console.WriteLine("hello" + a);
// 여기에 a변수와 위의 a변수는 노상관
// scopeが別れている
return x + y;
}
}
///////
///a가 두 군에서 나오는데 메소드안에 있는 거는 다르다. 구분된다.
////