{"id":4166,"date":"2019-03-24T10:22:28","date_gmt":"2019-03-24T01:22:28","guid":{"rendered":"https:\/\/www.wsmeguro.jp\/wp\/?p=4166"},"modified":"2025-01-13T17:16:26","modified_gmt":"2025-01-13T08:16:26","slug":"dart%e3%81%ae%e5%8b%89%e5%bc%b7%ef%bc%97%ef%bc%9a%e9%96%a2%e6%95%b0","status":"publish","type":"post","link":"https:\/\/www.wsmeguro.jp\/wp\/?p=4166","title":{"rendered":"Dart\u306e\u52c9\u5f37\uff18\uff1a\u95a2\u6570"},"content":{"rendered":"<p>\u4e00\u822c\u7684\u306a\u5f15\u6570\u3092\u8981\u6c42\u3059\u308b\u95a2\u6570\u3067\u3059\u3002\u5f15\u6570\u3092\u5fc5\u9808\u306b\u3057\u306a\u3044\u5834\u5408\u306f[]\u3067\u62ec\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u5f15\u6570\u3067\u6e21\u3055\u308c\u306a\u3044\u5834\u5408\u3001\u5185\u90e8\u3067\u306fnull\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"lang:java decode:true \" >void main() {\r\n  printNames1(\"Tokyo\", \"Sapporo\", \"London\");\r\n  printNames2(\"JPY\", \"USD\");\r\n}\r\n\r\nvoid printNames1(String name1, String name2, String name3) {\r\n  print(\"Name 1 is $name1.\");\r\n  print(\"Name 2 is $name2.\");\r\n  print(\"Name 3 is $name3.\");\r\n}\r\n\r\nvoid printNames2(String name1, [String name2, String name3]) {\r\n  name2 = name2 ?? \"No Name\";\r\n  name3 = name3 ?? \"No Name\";\r\n  print(\"Name 1 is $name1.\");\r\n  print(\"Name 2 is $name2.\");\r\n  print(\"Name 3 is $name3.\");\r\n}\r\n<\/pre>\n<p>\u7d50\u679c\u306f\u3001\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<br \/>\nName 1 is Tokyo.<br \/>\nName 2 is Sapporo.<br \/>\nName 3 is London.<br \/>\nName 1 is JPY.<br \/>\nName 2 is USD.<br \/>\nName 3 is No Name.<br \/>\n<!--more--><\/p>\n<p>\u8a08\u7b97\u7d50\u679c\u3092\u8fd4\u3059\u5834\u5408\u306f\u3001return\u3067\u8fd4\u3059\u5024\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u307e\u305f\u3001\u95a2\u6570\u540d\u306e\u524d\u306b\u8fd4\u3059\u5024\u306e\u30bf\u30a4\u30d7\u3092\u66f8\u3044\u3066\u3082\u66f8\u304b\u306a\u304f\u3066\u3082OK\u3067\u3059\u3002<br \/>\n\u307e\u305f\u3001\u8a08\u7b97\u304c\uff11\u884c\u3067\u6e08\u3080\u5834\u5408\u306f\u3001\u30a2\u30ed\u30fc\u95a2\u6570\u3067\u30b7\u30f3\u30d7\u30eb\u306b\u8868\u8a18\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:java decode:true \" >void main() {\r\n  print(\"a circumference of 5cm radius is ${getCircumference(5)}.\");\r\n  print(\"a circumference of 5cm radius is ${getCircum(5)}.\");\r\n}\r\n\r\nnum getCircumference(num radius) {\r\n  num circumference = 2 * 3.14 * radius;\r\n  return circumference;\r\n}\r\n\r\nnum getCircum(num radius) =&gt; 2 * 3.14 * radius;<\/pre>\n<p>a circumference of 5cm radius is 31.400000000000002.<br \/>\na circumference of 5cm radius is 31.400000000000002.<\/p>\n<p>\u5f15\u6570\u304c\u305f\u304f\u3055\u3093\u3042\u308b\u5834\u5408\u306f\u3001\u5f15\u6570\u306e\u540d\u524d\u3092\u4ed8\u3051\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002\u3053\u308c\u306f\u3001\u8da3\u5473\u3060\u3068\u601d\u3044\u307e\u3059\u304c\u30fb\u30fb<\/p>\n<pre class=\"lang:java decode:true \" >void main() {\r\n  getPerimeter(4, 5);\r\n  getArea(7, 9);\r\n  print(\"The volume is ${getVolume(8, height: 4, breadth: 7)}.\");\r\n}\r\n\r\ngetPerimeter(int length, int breadth) {\r\n  int perimeter = 2 * (length + breadth);\r\n  print(\"The perimeter is $perimeter.\");\r\n}\r\n\r\ngetArea(int length, int breadth) {\r\n  int area = length * breadth;\r\n  print(\"The area is $area.\");\r\n}\r\n\r\ngetVolume(int length, {int breadth, int height}) =&gt; length * breadth * height;\r\n<\/pre>\n<p>\u5b9f\u884c\u7d50\u679c\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<br \/>\nThe perimeter is 18.<br \/>\nThe area is 63.<br \/>\nThe volume is 224.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u822c\u7684\u306a\u5f15\u6570\u3092\u8981\u6c42\u3059\u308b\u95a2\u6570\u3067\u3059\u3002\u5f15\u6570\u3092\u5fc5\u9808\u306b\u3057\u306a\u3044\u5834\u5408\u306f[]\u3067\u62ec\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u5f15\u6570\u3067\u6e21\u3055\u308c\u306a\u3044\u5834\u5408\u3001\u5185\u90e8\u3067\u306fnull\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002 void main() { printNames1(&#8220;Tokyo&#8221;, &#8220;Sappo&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"footnotes":""},"categories":[595,505],"tags":[601,597,618,619,632,633,599],"class_list":{"0":"post-4166","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-dart2","7":"category-programming","8":"tag-dart","9":"tag-dart2","10":"tag-dartpad","12":"tag-option","13":"tag-633","14":"tag-599"},"_links":{"self":[{"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=\/wp\/v2\/posts\/4166","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4166"}],"version-history":[{"count":5,"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=\/wp\/v2\/posts\/4166\/revisions"}],"predecessor-version":[{"id":4216,"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=\/wp\/v2\/posts\/4166\/revisions\/4216"}],"wp:attachment":[{"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4166"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4166"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4166"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}