<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Reference on Zenth Programming Language</title><link>https://mkaz.github.io/zenth/reference/</link><description>Recent content in Reference on Zenth Programming Language</description><generator>Hugo</generator><language>en-us</language><atom:link href="https://mkaz.github.io/zenth/reference/index.xml" rel="self" type="application/rss+xml"/><item><title>Variables</title><link>https://mkaz.github.io/zenth/reference/variables/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mkaz.github.io/zenth/reference/variables/</guid><description>&lt;p&gt;Zenth has three ways to declare variables: &lt;code&gt;let&lt;/code&gt;, &lt;code&gt;var&lt;/code&gt;, and &lt;code&gt;const&lt;/code&gt;. All declarations use &lt;code&gt;=&lt;/code&gt; for assignment &amp;ndash; there is no &lt;code&gt;:=&lt;/code&gt; operator.&lt;/p&gt;
&lt;h2 id="immutable-variables-with-let"&gt;&lt;a class="anchor" href="#immutable-variables-with-let"&gt;#&lt;/a&gt;Immutable Variables with &lt;code&gt;let&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;let&lt;/code&gt; declares an immutable binding. Once assigned, its value cannot change:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;let name = &amp;#34;Zenth&amp;#34;;
let year = 2026;
let pi = 3.14159;
let active = true;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Attempting to reassign a &lt;code&gt;let&lt;/code&gt; variable is a compile-time error:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;let x = 5;
x = 10; // error: cannot assign to immutable variable &amp;#39;x&amp;#39;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id="mutable-variables-with-var"&gt;&lt;a class="anchor" href="#mutable-variables-with-var"&gt;#&lt;/a&gt;Mutable Variables with &lt;code&gt;var&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;var&lt;/code&gt; declares a mutable binding that can be reassigned:&lt;/p&gt;</description></item><item><title>Types</title><link>https://mkaz.github.io/zenth/reference/types/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mkaz.github.io/zenth/reference/types/</guid><description>&lt;p&gt;Zenth is strongly typed with type inference for local variables. Function signatures always require explicit types.&lt;/p&gt;
&lt;h2 id="integer-types"&gt;&lt;a class="anchor" href="#integer-types"&gt;#&lt;/a&gt;Integer Types&lt;/h2&gt;
&lt;p&gt;Zenth has a single integer type: &lt;code&gt;Int&lt;/code&gt; (64-bit signed).&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;let x = 42; // Int (inferred)
let big: Int = 999;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Integer literals can use underscores for readability:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;let million = 1_000_000;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id="built-in-integer-constants"&gt;&lt;a class="anchor" href="#built-in-integer-constants"&gt;#&lt;/a&gt;Built-in Integer Constants&lt;/h3&gt;
&lt;p&gt;Zenth provides built-in constants for the integer range limits:&lt;/p&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Constant&lt;/th&gt;
 &lt;th&gt;Value&lt;/th&gt;
 &lt;th&gt;Description&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;code&gt;INT_MAX&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;9223372036854775807&lt;/td&gt;
 &lt;td&gt;Maximum &lt;code&gt;Int&lt;/code&gt; value (2^63-1)&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;code&gt;INT_MIN&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;-9223372036854775808&lt;/td&gt;
 &lt;td&gt;Minimum &lt;code&gt;Int&lt;/code&gt; value (-2^63)&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;These are true constants and cannot be reassigned:&lt;/p&gt;</description></item><item><title>Functions</title><link>https://mkaz.github.io/zenth/reference/functions/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mkaz.github.io/zenth/reference/functions/</guid><description>&lt;p&gt;Functions are declared with the &lt;code&gt;fn&lt;/code&gt; keyword. Every program needs a &lt;code&gt;main&lt;/code&gt; function as its entry point.&lt;/p&gt;
&lt;h2 id="declaring-functions"&gt;&lt;a class="anchor" href="#declaring-functions"&gt;#&lt;/a&gt;Declaring Functions&lt;/h2&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;fn greet(name: Str) {
 Println(&amp;#34;Hello, {name}!&amp;#34;);
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Parameters require explicit type annotations using the &lt;code&gt;name: Type&lt;/code&gt; syntax.&lt;/p&gt;
&lt;h2 id="return-types"&gt;&lt;a class="anchor" href="#return-types"&gt;#&lt;/a&gt;Return Types&lt;/h2&gt;
&lt;p&gt;Specify a return type with &lt;code&gt;-&amp;gt;&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;fn add(a: Int, b: Int) -&amp;gt; Int {
 return a &amp;#43; b;
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Functions without a &lt;code&gt;-&amp;gt;&lt;/code&gt; return type return nothing (void).&lt;/p&gt;
&lt;h2 id="calling-functions"&gt;&lt;a class="anchor" href="#calling-functions"&gt;#&lt;/a&gt;Calling Functions&lt;/h2&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;fn main() {
 greet(&amp;#34;World&amp;#34;);
 let result = add(3, 4);
 Println(result); // 7
}&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id="multiple-parameters"&gt;&lt;a class="anchor" href="#multiple-parameters"&gt;#&lt;/a&gt;Multiple Parameters&lt;/h2&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;fn clamp(value: Int, low: Int, high: Int) -&amp;gt; Int {
 if value &amp;lt; low {
 return low;
 }
 if value &amp;gt; high {
 return high;
 }
 return value;
}&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id="multi-return-functions"&gt;&lt;a class="anchor" href="#multi-return-functions"&gt;#&lt;/a&gt;Multi-Return Functions&lt;/h2&gt;
&lt;p&gt;Functions can return multiple values using a parenthesized return type. The caller unpacks the result with tuple destructuring:&lt;/p&gt;</description></item><item><title>Strings</title><link>https://mkaz.github.io/zenth/reference/strings/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mkaz.github.io/zenth/reference/strings/</guid><description>&lt;p&gt;Zenth has two kinds of string literals: double-quoted strings with interpolation, and single-quoted raw strings.&lt;/p&gt;
&lt;h2 id="double-quoted-strings"&gt;&lt;a class="anchor" href="#double-quoted-strings"&gt;#&lt;/a&gt;Double-Quoted Strings&lt;/h2&gt;
&lt;p&gt;Double-quoted strings (&lt;code&gt;&amp;quot;...&amp;quot;&lt;/code&gt;) support interpolation with &lt;code&gt;{expression}&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;let name = &amp;#34;World&amp;#34;;
Println(&amp;#34;Hello, {name}!&amp;#34;); // Hello, World!&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Any expression can go inside the braces &amp;ndash; variables, arithmetic, method calls:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;let a = 3;
let b = 4;
Println(&amp;#34;{a} &amp;#43; {b} = {a &amp;#43; b}&amp;#34;); // 3 &amp;#43; 4 = 7&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Values are automatically converted to strings, so you don&amp;rsquo;t need to call &lt;code&gt;Str()&lt;/code&gt; inside interpolation:&lt;/p&gt;</description></item><item><title>Control Flow</title><link>https://mkaz.github.io/zenth/reference/control-flow/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mkaz.github.io/zenth/reference/control-flow/</guid><description>&lt;h2 id="if--else"&gt;&lt;a class="anchor" href="#if--else"&gt;#&lt;/a&gt;If / Else&lt;/h2&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;if x &amp;gt; 10 {
 Println(&amp;#34;big&amp;#34;);
} else if x &amp;gt; 5 {
 Println(&amp;#34;medium&amp;#34;);
} else {
 Println(&amp;#34;small&amp;#34;);
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Conditions must be &lt;code&gt;Bool&lt;/code&gt; &amp;ndash; there is no truthy/falsy coercion. Parentheses around the condition are not required.&lt;/p&gt;
&lt;h2 id="for-loops"&gt;&lt;a class="anchor" href="#for-loops"&gt;#&lt;/a&gt;For Loops&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;for&lt;/code&gt; is the only loop keyword in Zenth. It supports five styles.&lt;/p&gt;
&lt;h3 id="c-style-for"&gt;&lt;a class="anchor" href="#c-style-for"&gt;#&lt;/a&gt;C-Style For&lt;/h3&gt;
&lt;p&gt;The classic three-part loop with init, condition, and post:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;for var i = 0; i &amp;lt; 10; i&amp;#43;&amp;#43; {
 Println(i);
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The init clause can declare a variable with &lt;code&gt;var&lt;/code&gt; or &lt;code&gt;let&lt;/code&gt;:&lt;/p&gt;</description></item><item><title>Enums</title><link>https://mkaz.github.io/zenth/reference/enums/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mkaz.github.io/zenth/reference/enums/</guid><description>&lt;p&gt;Enums define a type with a fixed set of named variants. Each variant is backed by a string value — by default the variant name itself.&lt;/p&gt;
&lt;h2 id="declaring-enums"&gt;&lt;a class="anchor" href="#declaring-enums"&gt;#&lt;/a&gt;Declaring Enums&lt;/h2&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;enum Color {
 Red;
 Green;
 Blue;
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Without explicit values, each variant&amp;rsquo;s string value is its name: &lt;code&gt;&amp;quot;Red&amp;quot;&lt;/code&gt;, &lt;code&gt;&amp;quot;Green&amp;quot;&lt;/code&gt;, &lt;code&gt;&amp;quot;Blue&amp;quot;&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id="explicit-string-values"&gt;&lt;a class="anchor" href="#explicit-string-values"&gt;#&lt;/a&gt;Explicit String Values&lt;/h2&gt;
&lt;p&gt;You can assign explicit string values to variants:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;enum HexColor {
 Red = &amp;#34;#FF0000&amp;#34;;
 Green = &amp;#34;#00FF00&amp;#34;;
 Blue = &amp;#34;#0000FF&amp;#34;;
}

enum Stoplight {
 Red = &amp;#34;red&amp;#34;;
 Yellow = &amp;#34;yellow&amp;#34;;
 Green = &amp;#34;green&amp;#34;;
}&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id="using-enums"&gt;&lt;a class="anchor" href="#using-enums"&gt;#&lt;/a&gt;Using Enums&lt;/h2&gt;
&lt;p&gt;Access variants with &lt;code&gt;EnumName.Variant&lt;/code&gt; syntax:&lt;/p&gt;</description></item><item><title>Objects</title><link>https://mkaz.github.io/zenth/reference/objects/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mkaz.github.io/zenth/reference/objects/</guid><description>&lt;p&gt;Objects are user-defined types with named fields. Methods are defined inside the object body using &lt;code&gt;self&lt;/code&gt; to access fields.&lt;/p&gt;
&lt;h2 id="declaring-an-object"&gt;&lt;a class="anchor" href="#declaring-an-object"&gt;#&lt;/a&gt;Declaring an Object&lt;/h2&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;obj Point {
 x: Float;
 y: Float;
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Fields are declared with &lt;code&gt;name: Type;&lt;/code&gt; syntax.&lt;/p&gt;
&lt;h2 id="default-field-values"&gt;&lt;a class="anchor" href="#default-field-values"&gt;#&lt;/a&gt;Default Field Values&lt;/h2&gt;
&lt;p&gt;Fields can have default values. If a default is provided, the field becomes optional in the constructor:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;obj Account {
 balance: Int = 0;
 interest: Float = 2.5;
}&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id="creating-instances"&gt;&lt;a class="anchor" href="#creating-instances"&gt;#&lt;/a&gt;Creating Instances&lt;/h2&gt;
&lt;p&gt;Use constructor syntax with named arguments &lt;code&gt;Name(field=value)&lt;/code&gt;:&lt;/p&gt;</description></item><item><title>Arrays</title><link>https://mkaz.github.io/zenth/reference/arrays/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mkaz.github.io/zenth/reference/arrays/</guid><description>&lt;p&gt;Arrays are dynamically-sized sequences of elements, all of the same type.&lt;/p&gt;
&lt;h2 id="creating-arrays"&gt;&lt;a class="anchor" href="#creating-arrays"&gt;#&lt;/a&gt;Creating Arrays&lt;/h2&gt;
&lt;p&gt;Use bracket syntax for array literals:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;let numbers = [1, 2, 3, 4, 5];
let names = [&amp;#34;Alice&amp;#34;, &amp;#34;Bob&amp;#34;, &amp;#34;Charlie&amp;#34;];&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;With an explicit type annotation:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;let scores: Array(Int) = [100, 95, 87];&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;An empty slice can use a type annotation:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;var points: Array(Point) = [];
points.add(Point(x=1, y=2));&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Use &lt;code&gt;.repeat(n)&lt;/code&gt; to create an array by repeating elements:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;var zeros = [0].repeat(10); // [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
let dashes = [&amp;#34;-&amp;#34;].repeat(5); // [&amp;#34;-&amp;#34;, &amp;#34;-&amp;#34;, &amp;#34;-&amp;#34;, &amp;#34;-&amp;#34;, &amp;#34;-&amp;#34;]
let pattern = [1, 2].repeat(6); // [1, 2, 1, 2, 1, 2]&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When the source array has multiple elements, they tile to fill the requested count.&lt;/p&gt;</description></item><item><title>Tuples</title><link>https://mkaz.github.io/zenth/reference/tuples/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mkaz.github.io/zenth/reference/tuples/</guid><description>&lt;p&gt;Tuples are fixed-size ordered values that can hold mixed types. They come in two forms: positional and named.&lt;/p&gt;
&lt;h2 id="positional-tuples"&gt;&lt;a class="anchor" href="#positional-tuples"&gt;#&lt;/a&gt;Positional Tuples&lt;/h2&gt;
&lt;p&gt;Use &lt;code&gt;Tuple(...)&lt;/code&gt; to create a tuple with values accessed by numeric index:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;let t = Tuple(&amp;#34;hello&amp;#34;, 42);
Println(t.0); // &amp;#34;hello&amp;#34;
Println(t.1); // &amp;#34;42&amp;#34;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;With a type annotation:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;let pair: Tuple(Str,Int) = Tuple(&amp;#34;age&amp;#34;, 30);&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id="named-tuples"&gt;&lt;a class="anchor" href="#named-tuples"&gt;#&lt;/a&gt;Named Tuples&lt;/h2&gt;
&lt;p&gt;Named tuples add field names so you can access elements by name. Use &lt;code&gt;=&lt;/code&gt; for values and &lt;code&gt;:&lt;/code&gt; for types:&lt;/p&gt;</description></item><item><title>Hashmaps</title><link>https://mkaz.github.io/zenth/reference/hashmaps/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mkaz.github.io/zenth/reference/hashmaps/</guid><description>&lt;p&gt;Hashmaps are unordered collections of key-value pairs.&lt;/p&gt;
&lt;h2 id="creating-hashmaps"&gt;&lt;a class="anchor" href="#creating-hashmaps"&gt;#&lt;/a&gt;Creating Hashmaps&lt;/h2&gt;
&lt;p&gt;You can create a hashmap using the &lt;code&gt;Hashmap(KeyType, ValueType)&lt;/code&gt; built-in:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;var scores = Hashmap(Str,Int);&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id="assigning-and-accessing"&gt;&lt;a class="anchor" href="#assigning-and-accessing"&gt;#&lt;/a&gt;Assigning and Accessing&lt;/h2&gt;
&lt;p&gt;Use bracket syntax &lt;code&gt;[key]&lt;/code&gt; to assign and access values:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;scores[&amp;#34;Alice&amp;#34;] = 100;
scores[&amp;#34;Bob&amp;#34;] = 95;

let aliceScore = scores[&amp;#34;Alice&amp;#34;];
Println(aliceScore);&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id="hashmap-length"&gt;&lt;a class="anchor" href="#hashmap-length"&gt;#&lt;/a&gt;Hashmap Length&lt;/h2&gt;
&lt;p&gt;Use &lt;code&gt;Len()&lt;/code&gt; to get the number of key-value pairs in the hashmap:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;Println(Len(scores));&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id="default-values"&gt;&lt;a class="anchor" href="#default-values"&gt;#&lt;/a&gt;Default Values&lt;/h2&gt;
&lt;p&gt;You can provide a default value for missing keys using the &lt;code&gt;default&lt;/code&gt; named argument:&lt;/p&gt;</description></item><item><title>Sets</title><link>https://mkaz.github.io/zenth/reference/sets/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mkaz.github.io/zenth/reference/sets/</guid><description>&lt;p&gt;Sets are unordered collections of unique values.&lt;/p&gt;
&lt;h2 id="creating-sets"&gt;&lt;a class="anchor" href="#creating-sets"&gt;#&lt;/a&gt;Creating Sets&lt;/h2&gt;
&lt;p&gt;Create an empty set with &lt;code&gt;Set(Type)&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;var visited = Set(Str);
visited.add(&amp;#34;start&amp;#34;);
visited.add(&amp;#34;middle&amp;#34;);&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can also convert an array into a set with &lt;code&gt;Set(items)&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;let letters = [&amp;#34;a&amp;#34;, &amp;#34;b&amp;#34;, &amp;#34;a&amp;#34;];
let unique = Set(letters);
Println(Len(unique)); // 2&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id="core-operations"&gt;&lt;a class="anchor" href="#core-operations"&gt;#&lt;/a&gt;Core Operations&lt;/h2&gt;
&lt;p&gt;Use &lt;code&gt;.add(value)&lt;/code&gt; to insert an item, &lt;code&gt;.exists(value)&lt;/code&gt; to test membership, and &lt;code&gt;.remove(value)&lt;/code&gt; to delete an item:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;var nums = Set(Int);
nums.add(1);
nums.add(2);
nums.add(2); // duplicate, ignored

Println(nums.exists(1)); // true
nums.remove(1);
Println(Len(nums)); // 1&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Sets also expose &lt;code&gt;.length()&lt;/code&gt; when you prefer method syntax:&lt;/p&gt;</description></item><item><title>Dates</title><link>https://mkaz.github.io/zenth/reference/dates/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mkaz.github.io/zenth/reference/dates/</guid><description>&lt;p&gt;Zenth has a built-in &lt;code&gt;Date&lt;/code&gt; type for working with calendar dates. Dates are created using static constructors and support formatting, addition, and subtraction.&lt;/p&gt;
&lt;h2 id="creating-dates"&gt;&lt;a class="anchor" href="#creating-dates"&gt;#&lt;/a&gt;Creating Dates&lt;/h2&gt;
&lt;h3 id="todays-date"&gt;&lt;a class="anchor" href="#todays-date"&gt;#&lt;/a&gt;Today&amp;rsquo;s date&lt;/h3&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;let d = Date.today();&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Returns a &lt;code&gt;Date&lt;/code&gt; object representing the current date (time portion is midnight UTC).&lt;/p&gt;
&lt;h3 id="from-a-string"&gt;&lt;a class="anchor" href="#from-a-string"&gt;#&lt;/a&gt;From a string&lt;/h3&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;let epoch = Date.from(&amp;#34;1970-01-01&amp;#34;);&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Parses a date string using the default format &lt;code&gt;%Y-%m-%d&lt;/code&gt; (year-month-day).&lt;/p&gt;
&lt;h3 id="from-a-string-with-custom-format"&gt;&lt;a class="anchor" href="#from-a-string-with-custom-format"&gt;#&lt;/a&gt;From a string with custom format&lt;/h3&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;let jan13 = Date.from(&amp;#34;01/13/2007&amp;#34;, &amp;#34;%m/%d/%Y&amp;#34;);&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The second argument is a Python-style format string. Available format specifiers:&lt;/p&gt;</description></item><item><title>Files</title><link>https://mkaz.github.io/zenth/reference/files/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mkaz.github.io/zenth/reference/files/</guid><description>&lt;p&gt;The &lt;code&gt;File()&lt;/code&gt; built-in creates a file object for reading and writing files and inspecting file paths. File objects are value types &amp;ndash; there are no open handles and nothing to close.&lt;/p&gt;
&lt;h2 id="creating-a-file-object"&gt;&lt;a class="anchor" href="#creating-a-file-object"&gt;#&lt;/a&gt;Creating a File Object&lt;/h2&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;let f = File(&amp;#34;/path/to/data.txt&amp;#34;);&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id="methods"&gt;&lt;a class="anchor" href="#methods"&gt;#&lt;/a&gt;Methods&lt;/h2&gt;
&lt;h3 id="exists"&gt;&lt;a class="anchor" href="#exists"&gt;#&lt;/a&gt;exists&lt;/h3&gt;
&lt;p&gt;Returns &lt;code&gt;true&lt;/code&gt; if the file exists on disk:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;let f = File(&amp;#34;config.txt&amp;#34;);
if f.exists() {
 Println(&amp;#34;found it&amp;#34;);
}&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id="read"&gt;&lt;a class="anchor" href="#read"&gt;#&lt;/a&gt;read&lt;/h3&gt;
&lt;p&gt;Returns the full file contents as a string. Exits with an error if the file cannot be read:&lt;/p&gt;</description></item><item><title>Imports</title><link>https://mkaz.github.io/zenth/reference/imports/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mkaz.github.io/zenth/reference/imports/</guid><description>&lt;p&gt;Zenth provides access to standard library functionality through imports. Under the hood, these map to Go standard library packages.&lt;/p&gt;
&lt;h2 id="basic-import"&gt;&lt;a class="anchor" href="#basic-import"&gt;#&lt;/a&gt;Basic Import&lt;/h2&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;import &amp;#34;fmt&amp;#34;;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id="aliased-import"&gt;&lt;a class="anchor" href="#aliased-import"&gt;#&lt;/a&gt;Aliased Import&lt;/h2&gt;
&lt;p&gt;Use &lt;code&gt;as&lt;/code&gt; to give an import a shorter name:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;import &amp;#34;math&amp;#34; as m;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then call functions through the alias:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;let root = m.sqrt(16.0);&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id="available-modules"&gt;&lt;a class="anchor" href="#available-modules"&gt;#&lt;/a&gt;Available Modules&lt;/h2&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Zenth module&lt;/th&gt;
 &lt;th&gt;Maps to&lt;/th&gt;
 &lt;th&gt;Common functions&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;code&gt;fmt&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;Go &lt;code&gt;fmt&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;println&lt;/code&gt;, &lt;code&gt;printf&lt;/code&gt;, &lt;code&gt;sprintf&lt;/code&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;code&gt;math&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;Go &lt;code&gt;math&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;sqrt&lt;/code&gt;, &lt;code&gt;abs&lt;/code&gt;, &lt;code&gt;pow&lt;/code&gt;, &lt;code&gt;min&lt;/code&gt;, &lt;code&gt;max&lt;/code&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;code&gt;os&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;Go &lt;code&gt;os&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;exit&lt;/code&gt;, &lt;code&gt;args&lt;/code&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;code&gt;strings&lt;/code&gt; or &lt;code&gt;Str&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;Go &lt;code&gt;strings&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;&lt;code&gt;split&lt;/code&gt;, &lt;code&gt;join&lt;/code&gt;, &lt;code&gt;contains&lt;/code&gt;, &lt;code&gt;replace&lt;/code&gt;, &lt;code&gt;trim&lt;/code&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id="calling-module-functions"&gt;&lt;a class="anchor" href="#calling-module-functions"&gt;#&lt;/a&gt;Calling Module Functions&lt;/h2&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;import &amp;#34;math&amp;#34;;

fn main() {
 let x = math.sqrt(144.0);
 Println(x); // 12

 let y = math.pow(2.0, 10.0);
 Println(y); // 1024
}&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id="example-with-string-operations"&gt;&lt;a class="anchor" href="#example-with-string-operations"&gt;#&lt;/a&gt;Example with String Operations&lt;/h2&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;import &amp;#34;strings&amp;#34;;

fn main() {
 let csv = &amp;#34;apple,banana,cherry&amp;#34;;
 let parts = strings.split(csv, &amp;#34;,&amp;#34;);
 for part in parts {
 Println(part);
 }
}&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id="external-go-package-imports"&gt;&lt;a class="anchor" href="#external-go-package-imports"&gt;#&lt;/a&gt;External Go Package Imports&lt;/h2&gt;
&lt;p&gt;Use &lt;code&gt;import_go&lt;/code&gt; to import any Go package — including third-party libraries. The Zenth toolchain automatically fetches the package using &lt;code&gt;go get&lt;/code&gt; before compiling.&lt;/p&gt;</description></item><item><title>Modules</title><link>https://mkaz.github.io/zenth/reference/modules/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mkaz.github.io/zenth/reference/modules/</guid><description>&lt;p&gt;Zenth supports splitting programs across multiple files using local modules. A module is simply a &lt;code&gt;.zn&lt;/code&gt; File (or a directory of &lt;code&gt;.zn&lt;/code&gt; files) that you import into your program.&lt;/p&gt;
&lt;h2 id="importing-a-local-module"&gt;&lt;a class="anchor" href="#importing-a-local-module"&gt;#&lt;/a&gt;Importing a Local Module&lt;/h2&gt;
&lt;p&gt;Use a path starting with &lt;code&gt;./&lt;/code&gt; or &lt;code&gt;../&lt;/code&gt; to import a local module:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;import &amp;#34;./utils&amp;#34;;
import &amp;#34;./math/geometry&amp;#34;;
import &amp;#34;../shared/helpers&amp;#34;;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The module name is derived from the filename stem (the last path component without &lt;code&gt;.zn&lt;/code&gt;). Use &lt;code&gt;as&lt;/code&gt; to give it a custom alias:&lt;/p&gt;</description></item><item><title>Testing</title><link>https://mkaz.github.io/zenth/reference/testing/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mkaz.github.io/zenth/reference/testing/</guid><description>&lt;p&gt;Zenth has a built-in test runner that discovers and runs test functions. Test files live in a &lt;code&gt;tests/&lt;/code&gt; directory and use the &lt;code&gt;_test.zn&lt;/code&gt; suffix.&lt;/p&gt;
&lt;h2 id="writing-tests"&gt;&lt;a class="anchor" href="#writing-tests"&gt;#&lt;/a&gt;Writing Tests&lt;/h2&gt;
&lt;p&gt;Create a file ending with &lt;code&gt;_test.zn&lt;/code&gt; in a &lt;code&gt;tests/&lt;/code&gt; directory. Define test functions that start with &lt;code&gt;test_&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;// tests/math_test.zn

fn test_addition() {
 AssertEq(2 &amp;#43; 3, 5);
}

fn test_negative_numbers() {
 AssertEq(-3 &amp;#43; 3, 0);
 Assert(-1 &amp;lt; 0);
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Test files do not need a &lt;code&gt;fn main()&lt;/code&gt; &amp;ndash; the test runner generates one automatically.&lt;/p&gt;</description></item></channel></rss>