Dart 學習筆記1

在線編輯器工具dotpad

基本語法接觸

void main() {
  // this is my code.
  print("hello beibei,\nwelcome to our home.");

  // String name = "ZhangBeibei";
  var name = "ZhangBeibei";
  print(name);

  int num1 = 10;
  double num2 = 20;
  bool condition = true;
  print(num1);
  print(num2);
  print(condition);

  String car;
  // car = "Toyota";
  print(car);

  // String type 格式(三雙引號,多行字符串)
  String st1 = "this is single line";
  String st2 = '''that is not single line,
 it can be
 three line or
 four line or
 more line.''';
 String st3 = """this is a muiltline
測試多行字符串""";
 String st4 = "測試拼接 concatenation";
  print(st1);
  print(st2);
  print(st3 + "同時" + st4);
  
  // 字符串的另外的使用方式
  print("${st3}同時$st4");
  
}
相關文章
相關標籤/搜索