{"id":4161,"date":"2019-03-23T17:16:32","date_gmt":"2019-03-23T08:16:32","guid":{"rendered":"https:\/\/www.wsmeguro.jp\/wp\/?p=4161"},"modified":"2025-01-13T17:17:18","modified_gmt":"2025-01-13T08:17:18","slug":"dart%e3%81%ae%e5%8b%89%e5%bc%b7%ef%bc%97%ef%bc%9a%e7%b9%b0%e3%82%8a%e8%bf%94%e3%81%97","status":"publish","type":"post","link":"https:\/\/www.wsmeguro.jp\/wp\/?p=4161","title":{"rendered":"Dart\u306e\u52c9\u5f37\uff17\uff1a\u7e70\u308a\u8fd4\u3057"},"content":{"rendered":"<p>\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u306b\u306ffor\u3068while\u3068do-while\u306e\uff13\u3064\u306e\u65b9\u6cd5\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"lang:java decode:true \">void main() {\r\n  \/\/for loop\r\n  for (int i = 0; i &lt; 10; i++) {\r\n    if (i % 2 == 0) {\r\n      print(i);\r\n    }\r\n  }\r\n  List planetList = [\"Mercury\", \"Venus\", \"Earth\", \"Mars\"];\r\n  for (String planet in planetList) {\r\n    print(planet);\r\n  }\r\n\r\n  \/\/while\r\n  var i = 0;\r\n  while (i &lt; 10) {\r\n    print(\"$i in while\");\r\n    i++;\r\n  }\r\n\r\n  do {\r\n    print(\"$i in do-while\");\r\n    i++;\r\n  } while (i &lt; 10);\r\n}\r\n<\/pre>\n<p><!--more--><\/p>\n<p>\u5b9f\u884c\u7d50\u679c\u306f<br \/>\n0<br \/>\n2<br \/>\n4<br \/>\n6<br \/>\n8<br \/>\nMercury<br \/>\nVenus<br \/>\nEarth<br \/>\nMars<br \/>\n10 in do-while<br \/>\n\u3068\u306a\u3063\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n<p>\u7279\u5fb4\u306f\u3001for\u306f\u30ab\u30c3\u30b3\u5185\u306e\u51e6\u7406\u304c\u7d42\u308f\u308b\u3068\u52dd\u624b\u306b\u30ab\u30a6\u30f3\u30c8\u3092\u3057\u3066\u6240\u5b9a\u306e\u6761\u4ef6\u306b\u9054\u3057\u305f\u3089\u7d42\u308f\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002<br \/>\nwhile\u306f\u7d9a\u3044\u3066\u6307\u5b9a\u3059\u308b\u6761\u4ef6\u306b\u5408\u81f4\u3057\u306a\u3044\u3068\u51e6\u7406\u306f\u884c\u308f\u305a\u3001\u6b21\u306e\u30d6\u30ed\u30c3\u30af\u306b\u9032\u3093\u3067\u3057\u307e\u3044\u307e\u3059\u3002i=10\u3068\u304b\u6307\u5b9a\u3057\u3066\u3044\u308b\u3068\u3001\u51e6\u7406\u305b\u305a\u5148\u306b\u884c\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002<br \/>\ndo-while\u306f\u3001\u5fc5\u305a1\u56de\u306fdo\u306e\u5f8c\u306e\u51e6\u7406\u3092\u884c\u3063\u3066\u3001\u6761\u4ef6\u306b\u3042\u3063\u3066\u3057\u306a\u3044\u3068\u7d42\u308f\u308a\u307e\u3059\u3002<\/p>\n<p>break\u3092\u5165\u308c\u308b\u3068\u5b9f\u884c\u4e2d\u306e\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u3092\u9014\u4e2d\u3067\u7d42\u308f\u308a\u307e\u3059\u3002\u307e\u305f\u3001\u30e9\u30d9\u30eb\u3092\u3064\u3051\u3066\u30e9\u30d9\u30eb\u6307\u5b9a\u3067break\u3059\u308b\u3068\u3001\u305d\u306e\u30e9\u30d9\u30eb\u306e\u51e6\u7406\u3092\u7d42\u308f\u3089\u305b\u307e\u3059\u3002<br \/>\ncontinue\u306f\u3001\u51e6\u7406\u306f\u7d42\u308f\u3089\u305a\u30b9\u30ad\u30c3\u30d7\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:java decode:true \" >void main() {\r\n  outerLoop:\r\n  for (int i1 = 0; i1 &lt; 5; i1++) {\r\n    for (int i2 = 0; i2 &lt; 5; i2++) {\r\n      if (i2==1){\r\n        continue;\r\n      }\r\n      print(\"$i1 $i2\");\r\n      if (i1&gt;3 &amp;&amp; i2 &gt; 2) {\r\n        break outerLoop;\r\n      }\r\n    }\r\n  }\r\n}<\/pre>\n<p>\u5b9f\u884c\u7d50\u679c\u306f<br \/>\n0 0<br \/>\n0 2<br \/>\n0 3<br \/>\n0 4<br \/>\n1 0<br \/>\n1 2<br \/>\n1 3<br \/>\n1 4<br \/>\n2 0<br \/>\n2 2<br \/>\n2 3<br \/>\n2 4<br \/>\n3 0<br \/>\n3 2<br \/>\n3 3<br \/>\n3 4<br \/>\n4 0<br \/>\n4 2<br \/>\n4 3<br \/>\n\u3068\u3044\u3046\u3053\u3068\u3067\u3001i2\u304c\uff11\u306e\u6642\u306fcontinue\u4ee5\u964d\u306e\u51e6\u7406\u306f\u98db\u3070\u3055\u308c\u3066\u3001i1\u304c\uff14\u3067i2\u304c3\u306b\u306a\u3063\u305f\u3068\u3053\u308d\u3067\u3001\u5916\u5074\u306efor\u30eb\u30fc\u30d7\u304c\u7d42\u4e86\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\u8a08\u7b97\u4e2d\u306b\u3042\u308b\u4e00\u5b9a\u306e\u5024\u3092\u8d85\u3048\u305f\u3089\u7d42\u308f\u308b\u3068\u304b\u3001\uff10\u304c\u3067\u305f\u3089\u305d\u306e\u51e6\u7406\u306f\u98db\u3070\u3059\u3068\u304b\u3067\u4f7f\u3063\u305f\u308a\u3057\u307e\u3059\u3002<br \/>\ncontinue\u3082\u30e9\u30d9\u30eb\u6307\u5b9a\u3067\u304d\u307e\u3059\u304c\u3001\u30e9\u30d9\u30eb\u6307\u5b9a\u3057\u3066\u5916\u5074\u306e\u30eb\u30fc\u30d7\u306b\u98db\u3093\u3060\u3089\u3001\u5185\u5074\u306e\u30eb\u30fc\u30d7\u306f\u4ee5\u964d\u306e\u51e6\u7406\u304c\u5168\u3066\u98db\u3070\u3055\u308c\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"lang:js decode:true \" >void main() {\r\n  outerLoop:\r\n  for (int i1 = 0; i1 &lt; 5; i1++) {\r\n    for (int i2 = 0; i2 &lt; 5; i2++) {\r\n      if (i2==3){\r\n        continue outerLoop;\r\n      }\r\n      print(\"$i1 $i2\");\r\n      if (i1&gt;3 &amp;&amp; i2 &gt; 2) {\r\n        break outerLoop;\r\n      }\r\n    }\r\n  }\r\n}<\/pre>\n<p>0 0<br \/>\n0 1<br \/>\n0 2<br \/>\n1 0<br \/>\n1 1<br \/>\n1 2<br \/>\n2 0<br \/>\n2 1<br \/>\n2 2<br \/>\n3 0<br \/>\n3 1<br \/>\n3 2<br \/>\n4 0<br \/>\n4 1<br \/>\n4 2<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u306b\u306ffor\u3068while\u3068do-while\u306e\uff13\u3064\u306e\u65b9\u6cd5\u304c\u3042\u308a\u307e\u3059\u3002 void main() { \/\/for loop for (int i = 0; i &lt; 10; i++) { if (i % 2 ==&#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":[619,631,629,630,628],"class_list":["post-4161","post","type-post","status-publish","format-standard","hentry","category-dart2","category-programming","tag-dart","tag-do-while","tag-for","tag-while","tag-628"],"_links":{"self":[{"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=\/wp\/v2\/posts\/4161","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=4161"}],"version-history":[{"count":5,"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=\/wp\/v2\/posts\/4161\/revisions"}],"predecessor-version":[{"id":4217,"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=\/wp\/v2\/posts\/4161\/revisions\/4217"}],"wp:attachment":[{"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4161"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}