<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>How-to Guides on Zenth Programming Language</title><link>https://mkaz.github.io/zenth/howto/</link><description>Recent content in How-to Guides on Zenth Programming Language</description><generator>Hugo</generator><language>en-us</language><atom:link href="https://mkaz.github.io/zenth/howto/index.xml" rel="self" type="application/rss+xml"/><item><title>Getting Started</title><link>https://mkaz.github.io/zenth/howto/getting-started/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mkaz.github.io/zenth/howto/getting-started/</guid><description>&lt;h1 id="getting-started"&gt;&lt;a class="anchor" href="#getting-started"&gt;#&lt;/a&gt;Getting Started&lt;/h1&gt;
&lt;h2 id="prerequisites"&gt;&lt;a class="anchor" href="#prerequisites"&gt;#&lt;/a&gt;Prerequisites&lt;/h2&gt;
&lt;p&gt;Zenth compiles to native binaries through Go, so you need:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://go.dev/dl/"&gt;Go&lt;/a&gt; 1.26 or later&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/casey/just"&gt;just&lt;/a&gt; command runner (optional, for convenience)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="installation"&gt;&lt;a class="anchor" href="#installation"&gt;#&lt;/a&gt;Installation&lt;/h2&gt;
&lt;p&gt;Clone the repository and build the compiler:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-sh"&gt;git clone https://github.com/mkaz/zenth.git
cd zenth
just build&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This produces a &lt;code&gt;zenth&lt;/code&gt; binary in the current directory. To install it to your &lt;code&gt;$GOPATH/bin&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-sh"&gt;just install&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id="your-first-program"&gt;&lt;a class="anchor" href="#your-first-program"&gt;#&lt;/a&gt;Your First Program&lt;/h2&gt;
&lt;p&gt;Create a file called &lt;code&gt;hello.zn&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;fn main() {
 Println(&amp;#34;Hello, World!&amp;#34;);
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Every Zenth program needs a &lt;code&gt;main&lt;/code&gt; function as its entry point.&lt;/p&gt;</description></item><item><title>Read and Process a File</title><link>https://mkaz.github.io/zenth/howto/read-a-file/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mkaz.github.io/zenth/howto/read-a-file/</guid><description>&lt;h1 id="read-and-process-a-file"&gt;&lt;a class="anchor" href="#read-and-process-a-file"&gt;#&lt;/a&gt;Read and Process a File&lt;/h1&gt;
&lt;p&gt;This guide shows how to read a file, process its contents line by line, and write the results to another file.&lt;/p&gt;
&lt;h2 id="read-an-entire-file-as-a-string"&gt;&lt;a class="anchor" href="#read-an-entire-file-as-a-string"&gt;#&lt;/a&gt;Read an entire file as a string&lt;/h2&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;fn main() {
 let content = File(&amp;#34;input.txt&amp;#34;).read();
 Println(content);
}&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id="read-a-file-line-by-line"&gt;&lt;a class="anchor" href="#read-a-file-line-by-line"&gt;#&lt;/a&gt;Read a file line by line&lt;/h2&gt;
&lt;p&gt;Use &lt;code&gt;.lines()&lt;/code&gt; to get an array of strings, one per line:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;fn main() {
 let lines = File(&amp;#34;input.txt&amp;#34;).lines();
 for i, line in lines {
 Println(&amp;#34;{i}: {line}&amp;#34;);
 }
}&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id="check-if-a-file-exists-first"&gt;&lt;a class="anchor" href="#check-if-a-file-exists-first"&gt;#&lt;/a&gt;Check if a file exists first&lt;/h2&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;fn main() {
 let f = File(&amp;#34;input.txt&amp;#34;);
 if !f.exists() {
 Println(&amp;#34;file not found: &amp;#34; &amp;#43; f.name());
 Exit(1);
 }
 let lines = f.lines();
 Println(&amp;#34;Read {lines.length()} lines&amp;#34;);
}&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id="process-and-write-results-to-a-new-file"&gt;&lt;a class="anchor" href="#process-and-write-results-to-a-new-file"&gt;#&lt;/a&gt;Process and write results to a new file&lt;/h2&gt;
&lt;p&gt;Read lines, transform them, and write the output:&lt;/p&gt;</description></item><item><title>Parse Puzzle Input</title><link>https://mkaz.github.io/zenth/howto/parse-data/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://mkaz.github.io/zenth/howto/parse-data/</guid><description>&lt;h1 id="parse-puzzle-input"&gt;&lt;a class="anchor" href="#parse-puzzle-input"&gt;#&lt;/a&gt;Parse Puzzle Input&lt;/h1&gt;
&lt;p&gt;This guide shows common parsing patterns for structured text input: one number per line, comma-separated values, blank-line sections, coordinates, key/value fields, and mixed text. These are the kinds of transformations that come up constantly in Advent of Code problems.&lt;/p&gt;
&lt;h2 id="read-a-whole-file-and-trim-it"&gt;&lt;a class="anchor" href="#read-a-whole-file-and-trim-it"&gt;#&lt;/a&gt;Read a whole file and trim it&lt;/h2&gt;
&lt;p&gt;Use &lt;code&gt;.read()&lt;/code&gt; when the input is one block of text, then &lt;code&gt;.strip()&lt;/code&gt; to remove the trailing newline:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-zenth"&gt;fn main() {
 let raw = File(&amp;#34;input.txt&amp;#34;).read().strip();
 Println(raw);
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is useful for single-line inputs like &lt;code&gt;389125467&lt;/code&gt; or &lt;code&gt;target area: x=20..30, y=-10..-5&lt;/code&gt;.&lt;/p&gt;</description></item></channel></rss>