✳ 함수
→ 50만줄 수준 (상용 게임)
→ Method Function : 메소드 = 함수
→ C++ = Function 대부분 함수라고해서 통용함
→ 사용법 : 한정자 반환형식 이름(매개변수목록)
→ void(빈값)을 사용하면 return(반환)값이 없어도 가능
using System.Security.Cryptography.X509Certificates;
namespace CShop
{
class Program
{
static void HelloWorld() // void 이므로 return(반환) 할 필요없음
{
Console.WriteLine("함수 작동");
}
static void Main(string[] args)
{
HelloWorld();
}
}
}
using System.Security.Cryptography.X509Certificates;
namespace CShop
{
class Program
{
// 덧셈 함수
static int Add(int a, int b) // 출력하는 형식은 정수만 할거라 int
{
int result = a + b;
return result;
// return a + b; // return >> 값을 뱉어주겠다.
}
static void Main(string[] args)
{
int result = Add(1, 5);
Console.WriteLine(result);
}
}
}