KO CSharp Keyword return - LIHACHTETAN/ClassicUO-Bad-Newbie-CSharp-Scripts-IDE GitHub Wiki
ะฃะบัะฐัะฝััะบะฐ ยท ะ ัััะบะธะน ยท English ยท Deutsch ยท Franรงais ยท Italiano ยท Espaรฑol ยท ็น้ซไธญๆ ยท ๆฅๆฌ่ช ยท ํ๊ตญ์ด
C#: return
ํธ๋๋ถ C# ยท ์ค์ฉ ๊ฐ์ด๋
ํ์ฌ ๋ฉ์๋๋ ํจ์๋ฅผ ์ข ๋ฃํฉ๋๋ค. void ๋ฉ์๋๊ฐ ์๋ ๋ฉ์๋์ ๋ํ ๊ฒฐ๊ณผ๋ฅผ ๋ฐํํฉ๋๋ค.
๊ฐ๋จํ ์์ (Example.cs)
์ด ์์ ๋ฅผ Example.cs๋ก ๋ฐ๋ก ์ ์ฅํ๊ณ ์ด ํ์ด์ง์ ๋ค๋ฅธ ์์ ์ ๋
๋ฆฝ์ ์ผ๋ก ์คํํ์ธ์.
Example.cs:
// PROJECT-EXAMPLE
int Double(int value) { return value * 2; }
System.Console.WriteLine(Double(4));
๊ฒฐ๊ณผ:
8
ํต์ฌ๋ก
return; / return expression; / return ref variable;
์์ 1: ๊ธฐ๋ณธ ํํ
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
public static class Program
{
public static async Task Main(string[] args)
{
Console.WriteLine(Functions.Double(4));
}
}
public static class Functions { public static int Double(int value) { return value * 2; } }
์ 2: ๋ ๋ค๋ฅธ ์ค์ ํ์
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
public static class Program
{
public static async Task Main(string[] args)
{
Functions.Report("");
Functions.Report("Ready");
}
}
public static class Functions { public static void Report(string value) { if (value.Length == 0) return; Console.WriteLine(value); } }
๊ณต์ ์ถ์ฒ: Microsoft ํ์ต.