<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>albatrus</author_name>
  <author_url>https://blog.hatena.ne.jp/albatrus/</author_url>
  <blog_title>albatrusのブログ</blog_title>
  <blog_url>https://albatrus.com/</blog_url>
  <categories>
    <anon>Unity</anon>
  </categories>
  <description>ある数字を+１ずつ足していき、〇〇以上になった場合に0に戻す。 こういったロジックを実装するときにmod2を使うと簡単に書くことができます。 普通に計算する 「ある数字を+１ずつ足していき、〇〇以上になった場合に0に戻す。」をwhile文を使って実装した場合、このようななります。 while (index != 0) { index = index + 1; if (index &gt; 5) { index = 0; } } mod2を使う 先程の処理はmod2を使えば次のように置き換えることができます。 while (index != 0) { index = (index + 1) % 5; …</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Falbatrus.com%2Fentry%2F2021%2F04%2F06%2F210000&quot; title=&quot;【Unity】 mod2演算とは - albatrusのブログ&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.blog.st-hatena.com/images/theme/og-image-1500.png</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2021-04-06 21:00:00</published>
  <title>【Unity】 mod2演算とは</title>
  <type>rich</type>
  <url>https://albatrus.com/entry/2021/04/06/210000</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
