<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>takamizawa46</author_name>
  <author_url>https://blog.hatena.ne.jp/takamizawa46/</author_url>
  <blog_title>やわらかテック</blog_title>
  <blog_url>https://www.okb-shelf.work/</blog_url>
  <categories>
    <anon>Ruby</anon>
    <anon>開発所感</anon>
    <anon>Python</anon>
  </categories>
  <description>先日、Rubyで文字列を指定数分だけ繰り返す処理を書いていた所、面白い現象に遭遇しました。 文字列を繰り返すために*を使ったのですが「文字列 * 数値」の場合はエラーが発生せずに望み通りの値が返るものの、順序を逆にして「数値 * 文字列」とするとエラーが発生します。 puts &quot;s&quot; * 5 # sssss puts 5 * &quot;s&quot; # Main.rb:3:in `*': String can't be coerced into Integer (TypeError) # from Main.rb:3:in `&lt;main&gt;'</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fwww.okb-shelf.work%2Fentry%2Fwhy_error_exchange__operation&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>https://cdn-ak.f.st-hatena.com/images/fotolife/t/takamizawa46/20230609/20230609145335.jpg</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2023-06-12 08:59:39</published>
  <title>Rubyで演算子の順序を入れ替えるとエラーになるのはなぜか</title>
  <type>rich</type>
  <url>https://www.okb-shelf.work/entry/why_error_exchange__operation</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
