<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>takuya_1st</author_name>
  <author_url>https://blog.hatena.ne.jp/takuya_1st/</author_url>
  <blog_title>それマグで！</blog_title>
  <blog_url>https://takuya-1st.hatenablog.jp/</blog_url>
  <categories>
  </categories>
  <description>ruby で変数が初期化されてない時に、デフォルト値を代入しようとした。 a = ARGV[0] a ||= 100 もっとスマートに書けないかなぁ。 a = 100 || bでもこれを逆に書くと動かないんだ。 a = b || 100 NameError: undefined local variable or method `b' for main:Objectもちろん、変数がが初期化済みならエラーは出ない。逆もエラーにならない。 b = nil a = 100 || b #=&gt; 100逆 b = nil a = b || 100 #=&gt; 100 ということで || 演算子（なんて読むの？…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Ftakuya-1st.hatenablog.jp%2Fentry%2F20120712%2F1344805173&quot; title=&quot;Rubyで変数の初期化 - それマグで！&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2012-07-12 05:59:33</published>
  <title>Rubyで変数の初期化</title>
  <type>rich</type>
  <url>https://takuya-1st.hatenablog.jp/entry/20120712/1344805173</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
