一個大型的容器,可以在陣列裡面放多的資料,主要運用在統計上
int[ ] scores = { 50, 60, 70, 30, 20 };
/ 0 1 2 3 4
score[ 0 ] = 50; /可隨時調整第一個的成績
System.Console.Write( scores[ 0 ] );
System.Console.Write( scores[ 1 ] );
System.Console.Write( scores[ 2 ] );
System.Console.Write( scores[ 3 ] );
System.Console.Write( scores[ 4 ] );
string[ ] phones = new string[ 10 ]; /框框內的數字代表可以放幾個值
phones[ 0 ] = “0123456789”;
phones[ 1 ] = “0888888888”;
System.Console.Write( phones[ 0 ] );
System.Console.Write( phones[ 1 ] );
今日學習了關於陣列的用法,這個方式我在之前大學聽教授教學時也有聽過,這是可以統計許多物件的好方法,可以方便改物件的數值,在遊戲程式中也很好用。明天會學習到常見的if判斷,我們明天見~
【C#】3小時初學者教學 |Csharp | C# 教學 | C# 入門 | C++++
YouTube頻道:GrandmaCan -我阿嬤都會
影片段落: 1:07:47 ~ 1:15:28 (時間段已設定好)