{"route":"/en-US-v0.13.1/reference/foundations/version/","title":"Version","description":"Documentation for the Version type.","part":null,"outline":[{"id":"summary","name":"Summary","children":[]},{"id":"constructor","name":"Constructor","children":[{"id":"constructor-components","name":"components","children":[]}]},{"id":"definitions","name":"Definitions","children":[{"id":"definitions-at","name":"At","children":[{"id":"definitions-at-index","name":"index","children":[]}]}]}],"body":{"kind":"type","content":{"name":"version","title":"Version","keywords":[],"oneliner":"A version with an arbitrary number of components.","details":"<p>A version with an arbitrary number of components.</p>\n<p>The first three components have names that can be used as fields: <code>major</code>,\n<code>minor</code>, <code>patch</code>. All following components do not have names.</p>\n<p>The list of components is semantically extended by an infinite list of\nzeros. This means that, for example, <code>0.8</code> is the same as <code>0.8.0</code>. As a\nspecial case, the empty version (that has no components at all) is the same\nas <code>0</code>, <code>0.0</code>, <code>0.0.0</code>, and so on.</p>\n<p>The current version of the Typst compiler is available as <code>sys.version</code>.</p>\n<p>You can convert a version to an array of explicitly given components using\nthe <a href=\"/en-US-v0.13.1/reference/foundations/array/\" title=\"`array`\"><code>array</code></a> constructor.</p>","constructor":{"path":[],"name":"version","title":"Construct","keywords":[],"oneliner":"Creates a new version.","element":false,"contextual":false,"deprecation":null,"details":"<p>Creates a new version.</p>\n<p>It can have any number of components (even zero).</p>","example":"<div class=\"previewed-code\"><pre><code><span class=\"typ-func\">#</span><span class=\"typ-func\">version</span><span class=\"typ-punct\">(</span><span class=\"typ-punct\">)</span> <span class=\"typ-escape\">\\</span>\n<span class=\"typ-func\">#</span><span class=\"typ-func\">version</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">1</span><span class=\"typ-punct\">)</span> <span class=\"typ-escape\">\\</span>\n<span class=\"typ-func\">#</span><span class=\"typ-func\">version</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-num\">3</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">4</span><span class=\"typ-punct\">)</span> <span class=\"typ-escape\">\\</span>\n<span class=\"typ-func\">#</span><span class=\"typ-func\">version</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-num\">3</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">4</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">)</span> <span class=\"typ-escape\">\\</span>\n<span class=\"typ-func\">#</span><span class=\"typ-func\">version</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-num\">3</span><span class=\"typ-punct\">)</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/171d7fe9db3c91b277e567ab934a88a9.png\" alt=\"Preview\"></div></div>","self":false,"params":[{"name":"components","details":"<p>The components of the version (array arguments are flattened)</p>","example":null,"types":["int","array"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":true,"settable":false}],"returns":["version"],"scope":[]},"scope":[{"path":["version"],"name":"at","title":"At","keywords":[],"oneliner":"Retrieves a component of a version.","element":false,"contextual":false,"deprecation":null,"details":"<p>Retrieves a component of a version.</p>\n<p>The returned integer is always non-negative. Returns <code>0</code> if the version\nisn't specified to the necessary length.</p>","example":null,"self":true,"params":[{"name":"index","details":"<p>The index at which to retrieve the component. If negative, indexes\nfrom the back of the explicitly given components.</p>","example":null,"types":["int"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false}],"returns":["int"],"scope":[]}]}}}