<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>a1026302</author_name>
  <author_url>https://blog.hatena.ne.jp/a1026302/</author_url>
  <blog_title>ものづくりのブログ</blog_title>
  <blog_url>https://a1026302.hatenablog.com/</blog_url>
  <categories>
    <anon>Crystal</anon>
    <anon>Crystal-構文</anon>
  </categories>
  <description>Ruby ライクなプログラミング言語 crystal について勉強してます。 今回は Crystal でユニオン型の変数について演算を行う際に苦労したので、ここにメモを残します。 REPL の icr で検証してみました。まずはユニオン型の変数(a)を作ります。 icr(0.33.0) &gt; if 1 + 2 == 3 icr(0.33.0) &gt; a = 1 icr(0.33.0) &gt; else icr(0.33.0) &gt; a = nil icr(0.33.0) &gt; end 確認方法は以下の通り。 icr(0.33.0) &gt; typeof(a) =&gt; (Int32 | Nil) この状態で演算処…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fa1026302.hatenablog.com%2Fentry%2F2021%2F12%2F11%2F160859&quot; title=&quot;【Crystal】ユニオン型で演算処理 - ものづくりのブログ&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>https://cdn.user.blog.st-hatena.com/default_entry_og_image/157314735/1599576939808917</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2021-12-11 16:08:59</published>
  <title>【Crystal】ユニオン型で演算処理</title>
  <type>rich</type>
  <url>https://a1026302.hatenablog.com/entry/2021/12/11/160859</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
