{"route":"/en-US-v0.14.1/reference/foundations/repr/","title":"Representation","description":"Documentation for the `repr` function.","part":null,"outline":[{"id":"summary","name":"Summary","children":[]},{"id":"example","name":"Example","children":[]},{"id":"debugging-only","name":"Debugging Only","children":[]},{"id":"parameters","name":"Parameters","children":[{"id":"parameters-value","name":"value","children":[]}]}],"body":{"kind":"func","content":{"path":[],"name":"repr","title":"Representation","keywords":[],"oneliner":"Returns the string representation of a value.","element":false,"contextual":false,"deprecationMessage":null,"deprecationUntil":null,"details":[{"kind":"html","content":"<p>Returns the string representation of a value.</p>\n<p>When inserted into content, most values are displayed as this representation\nin monospace with syntax-highlighting. The exceptions are <code><span class=\"typ-key\">none</span></code>,\nintegers, floats, strings, content, and functions.</p>\n<h2 id=\"example\">Example</h2>\n<div class=\"previewed-code\"><pre><code><span class=\"typ-key\">#</span><span class=\"typ-key\">none</span> vs <span class=\"typ-func\">#</span><span class=\"typ-func\">repr</span><span class=\"typ-punct\">(</span><span class=\"typ-key\">none</span><span class=\"typ-punct\">)</span> <span class=\"typ-escape\">\\</span>\n<span class=\"typ-str\">#</span><span class=\"typ-str\">&quot;hello&quot;</span> vs <span class=\"typ-func\">#</span><span class=\"typ-func\">repr</span><span class=\"typ-punct\">(</span><span class=\"typ-str\">&quot;hello&quot;</span><span class=\"typ-punct\">)</span> <span class=\"typ-escape\">\\</span>\n<span class=\"typ-punct\">#</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">1</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">2</span><span class=\"typ-punct\">)</span> vs <span class=\"typ-func\">#</span><span class=\"typ-func\">repr</span><span class=\"typ-punct\">(</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">1</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">2</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">)</span> <span class=\"typ-escape\">\\</span>\n<span class=\"typ-punct\">#</span><span class=\"typ-punct\">[</span><span class=\"typ-strong\">*Hi*</span><span class=\"typ-punct\">]</span> vs <span class=\"typ-func\">#</span><span class=\"typ-func\">repr</span><span class=\"typ-punct\">(</span><span class=\"typ-punct\">[</span><span class=\"typ-strong\">*Hi*</span><span class=\"typ-punct\">]</span><span class=\"typ-punct\">)</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.14.1/assets/84ebd00100d33ebdd6015bb8c7c1e483.png\" alt=\"Preview\"></div></div>\n<h2 id=\"debugging-only\">For debugging purposes only</h2>\n<p>This function is for debugging purposes. Its output should not be considered\nstable and may change at any time.</p>\n<p>To be specific, having the same <code>repr</code> does not guarantee that values are\nequivalent, and <code>repr</code> is not a strict inverse of <a href=\"/en-US-v0.14.1/reference/foundations/eval/\" title=\"`eval`\"><code>eval</code></a>. In the following\nexample, for readability, the <a href=\"/en-US-v0.14.1/reference/layout/length/\" title=\"`length`\"><code>length</code></a> is rounded to two significant\ndigits and the parameter list and body of the\n<a href=\"/en-US-v0.14.1/reference/foundations/function/#unnamed\">unnamed <code>function</code></a> are omitted.</p>\n<div class=\"previewed-code\"><pre><code><span class=\"typ-func\">#</span><span class=\"typ-func\">assert</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">2pt</span> <span class=\"typ-op\">/</span> <span class=\"typ-num\">3</span> <span class=\"typ-op\">&lt;</span> <span class=\"typ-num\">0.67pt</span><span class=\"typ-punct\">)</span>\n<span class=\"typ-func\">#</span><span class=\"typ-func\">repr</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">2pt</span> <span class=\"typ-op\">/</span> <span class=\"typ-num\">3</span><span class=\"typ-punct\">)</span>\n\n<span class=\"typ-func\">#</span><span class=\"typ-func\">repr</span><span class=\"typ-punct\">(</span>x <span class=\"typ-op\">=&gt;</span> x <span class=\"typ-op\">+</span> <span class=\"typ-num\">1</span><span class=\"typ-punct\">)</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.14.1/assets/38f26ff12687ae30b4bf7525a0e4dbd3.png\" alt=\"Preview\"></div></div>"}],"self":false,"params":[{"name":"value","details":[{"kind":"html","content":"<p>The value whose string representation to produce.</p>"}],"types":["any"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false}],"returns":["str"],"scope":[]}}}