{"id":819,"date":"2012-12-14T21:08:30","date_gmt":"2012-12-14T12:08:30","guid":{"rendered":"http:\/\/www.whoocus.com\/blog\/?p=819"},"modified":"2012-12-14T21:09:44","modified_gmt":"2012-12-14T12:09:44","slug":"scala%e4%ba%8b%e5%a7%8b%e3%82%81","status":"publish","type":"post","link":"https:\/\/www.blowfish.co.jp\/?p=819","title":{"rendered":"Scala\u4e8b\u59cb\u3081"},"content":{"rendered":"<p>Scala\u306b\u8208\u5473\u3092\u6301\u3063\u3066\u3001\u3068\u3044\u3046\u304bRuby\u3067\u3082\u826f\u304b\u3063\u305f\u306e\u3060\u304c\u30fb\u30fb\u30fb\u3002<br \/>\nJava\u7248\u306eRails \u306e\u3088\u3046\u306a\u304a\u6c17\u8efd\u8a00\u8a9e\u3092\u63a2\u3057\u3066\u3044\u305f\u3089\u3053\u308c\u3060\u3063\u305f\u3002<\/p>\n<p>\u307e\u305a\u306f\u7df4\u7fd2\u3067\u3059\u3002<\/p>\n<p>[scala]<br \/>\nobject Main {<\/p>\n<p>  def main(args:Array[String]):Unit = {<br \/>\n    var myVarName:String = &quot;\u30d0\u30fc&quot;<br \/>\n    myVarName = &quot;2&quot; + 2<\/p>\n<p>    val myValName = &quot;\u30d0\u30eb&quot;<br \/>\n    val fValue = 2.345 <\/p>\n<p>    println(&quot;Hello &quot; + myVarName + &quot; \u3002&quot;)<br \/>\n    println(&quot;Hello &quot; + myValName + &quot; \u3002&quot;)<br \/>\n    println(fValue + 7.655)<br \/>\n    println(&quot;&#8212;&#8212;-&quot;)<\/p>\n<p>    \/\/\u914d\u5217<br \/>\n    val books:Array[String] = Array(&quot;\u8f9e\u66f8&quot;,&quot;\u53c2\u8003\u66f8&quot;,&quot;\u554f\u984c\u96c6&quot;,&quot;\u65b0\u66f8&quot;,&quot;\u56f3\u9451&quot;,&quot;\u5c0f\u8aac&quot;)<br \/>\n    println(books.length + &quot;\u518a&quot;)<br \/>\n    for(book &lt;- books){<br \/>\n      println(book)<br \/>\n    }<br \/>\n    println(&quot;&#8212;&#8212;-&quot;)<\/p>\n<p>    \/\/\u30ea\u30b9\u30c8<br \/>\n    val cars:List[String] = List(&quot;\u30ab\u30ed\u30fc\u30e9&quot;,&quot;\u30d7\u30ea\u30a6\u30b9&quot;,&quot;\u30de\u30fc\u30c1&quot;,&quot;\u30d5\u30a3\u30c3\u30c8&quot;,&quot;\u30e0\u30fc\u30d6&quot;)<br \/>\n    println(cars.length + &quot;\u53f0&quot;)<br \/>\n    for(car &lt;- cars){<br \/>\n      println(car)<br \/>\n    }<br \/>\n    println(&quot;&#8212;&#8212;-&quot;)<\/p>\n<p>    \/\/\u30de\u30c3\u30d7<br \/>\n    val citys:Map[String, String]= Map(&quot;1&quot;-&gt;&quot;\u6771\u4eac&quot;, &quot;2&quot;-&gt;&quot;\u5927\u962a&quot;, &quot;3&quot;-&gt;&quot;\u798f\u5ca1&quot;)<br \/>\n    println(citys(&quot;1&quot;))<br \/>\n    println(citys(&quot;2&quot;))<\/p>\n<p>    println(citys.keys)<br \/>\n    println(citys.values)<\/p>\n<p>    \/\/\u95a2\u6570<br \/>\n    println(add(5, 7))<br \/>\n    println(reduce(5, 7))<br \/>\n    println(hello)<br \/>\n    bye<\/p>\n<p>  }<\/p>\n<p>  def add(x: Int, y: Int):Int = {<br \/>\n    x + y<br \/>\n  }<\/p>\n<p>  def reduce(x: Int, y: Int):Int = {<br \/>\n    x &#8211; y<br \/>\n  }<\/p>\n<p>  def hello:String = {<br \/>\n    &quot;\u65e9\u304f\u5e30\u308a\u305f\u3044\u3088\uff5e!!!&quot;<br \/>\n  }<\/p>\n<p>  def bye:Unit = {<br \/>\n    println(&quot;\u3055\u3088\u306a\u3089&quot;)<br \/>\n  }<br \/>\n}<br \/>\n[\/scala]<\/p>\n<p>\u5b9f\u969b\u3084\u3063\u3066\u307f\u308b\u3068\u3001\u7656\u3042\u308b\u306a\uff5e\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Scala\u306b\u8208\u5473\u3092\u6301\u3063\u3066\u3001\u3068\u3044\u3046\u304bRuby\u3067\u3082\u826f\u304b\u3063\u305f\u306e\u3060\u304c\u30fb\u30fb\u30fb\u3002 Java\u7248\u306eRails \u306e\u3088\u3046\u306a\u304a\u6c17\u8efd\u8a00\u8a9e\u3092\u63a2\u3057\u3066\u3044\u305f\u3089\u3053\u308c\u3060\u3063\u305f\u3002 \u307e\u305a\u306f\u7df4\u7fd2\u3067\u3059\u3002 [scala] object Main { def main( [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"saved_in_kubio":false,"footnotes":""},"categories":[31,4],"tags":[],"class_list":["post-819","post","type-post","status-publish","format-standard","hentry","category-scala","category-tech"],"_links":{"self":[{"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/819","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=819"}],"version-history":[{"count":2,"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/819\/revisions"}],"predecessor-version":[{"id":821,"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/819\/revisions\/821"}],"wp:attachment":[{"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=819"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=819"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=819"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}