Day 1 2020/09/17
//宣告字串變數
String str = "Apple";
//在畫面上印出
Console.WriteLine(str);
//6.0版本以前的印出
Console.WriteLine(string.Format("HI {0} {1} -4","Apple","bee"));
//6.0版本以後的印出
Console.WriteLine($"HI { str.ToUpper()} -5");
//清除畫面
Console.Clear();
//數值變數宣告
int i = 5;
//int 的最大值
int max = int.MaxValue; //最大值是: 2147483647
//int的最小值
int min = int.MinValue; //最小值是: -2147483648
//格式 Console.WriteLine($"demo: {demo1:代碼 數值}"); 不同的代碼與數值會有不同的呈現方式
double demo1 = 1.0 / 3; // = 0.333333333333333
Console.WriteLine($"demo: {demo1:F2}"); // 0.33
Console.ReadLine()
沒有留言:
張貼留言