Synchronization of old projects
Part1
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
namespace Lesson
|
||||
{
|
||||
class Program
|
||||
{
|
||||
#region 知识点一 基本概念
|
||||
//递归函数 就是 让函数自己调用自己
|
||||
//static void Fun()
|
||||
//{
|
||||
// Fun();
|
||||
//}
|
||||
//注意:这样会爆内存
|
||||
//所以 一个正确的递归函数必须要包括下面的特点
|
||||
//1.必须有结束调用的条件
|
||||
//2.用于条件判断的 这个条件 必须改变 能够达到停止的目的
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
#region 知识点二 实例
|
||||
//用递归函数打印出0到10
|
||||
static void Print(int a = 0)
|
||||
{
|
||||
Console.WriteLine(a);
|
||||
a++;
|
||||
if (a <= 10)
|
||||
{
|
||||
Print(a);
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Print();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user