<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>else Archives - Creatronix</title>
	<atom:link href="https://creatronix.de/tag/else/feed/" rel="self" type="application/rss+xml" />
	<link>https://creatronix.de/tag/else/</link>
	<description>My adventures in code &#38; business</description>
	<lastBuildDate>Mon, 20 Oct 2025 06:50:47 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Learning Kotlin &#8211; Part 4 &#8211; conditionals</title>
		<link>https://creatronix.de/learning-kotlin-part-4/</link>
		
		<dc:creator><![CDATA[Jörn]]></dc:creator>
		<pubDate>Mon, 03 Jun 2019 08:12:33 +0000</pubDate>
				<category><![CDATA[Kotlin & Java]]></category>
		<category><![CDATA[conditionals]]></category>
		<category><![CDATA[else]]></category>
		<category><![CDATA[if]]></category>
		<category><![CDATA[kotlin]]></category>
		<category><![CDATA[when]]></category>
		<guid isPermaLink="false">http://creatronix.de/?p=2691</guid>

					<description><![CDATA[<p>Conditionals This is a pretty quick one: Kotlin has the standard Java if / else if / else statements val age = 12 if (age &#60; 5) { println("Go to kindergarten") } else if (age == 5) { println("Go to pre-school") } else if (age &#62; 5 &#38;&#38; age &#60;= 17) { println("Go to grade&#8230;</p>
<p>The post <a href="https://creatronix.de/learning-kotlin-part-4/">Learning Kotlin &#8211; Part 4 &#8211; conditionals</a> appeared first on <a href="https://creatronix.de">Creatronix</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Conditionals</h2>
<p>This is a pretty quick one:</p>
<p>Kotlin has the standard Java if / else if / else statements</p>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-java" data-lang="Kotlin"><code>val age = 12

if (age &lt; 5) {
    println("Go to kindergarten")
} else if (age == 5) {
    println("Go to pre-school")
} else if (age &gt; 5 &amp;&amp; age &lt;= 17) {
    println("Go to grade ${age - 5}")
} else {
    println("Go to college!")
}</code></pre>
</div>
<p>But one nice feature is the when clause:</p>
<p>It feels like a mixture of switch/case and if/else with a flavor of ranges 🙂</p>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-java" data-lang="Kotlin"><code>when (age) { 
    0, 1, 2, 3, 4 -&gt; println("Go to preschool") 
    5 -&gt; println("Go to Kindergarten") 
    in 6..17 -&gt; { 
        val grade = age - 5 println("Go to grade $grade") 
    } 
    else -&gt; println("Go to college!") 
}</code></pre>
</div>
<p><a href="https://creatronix.de/learning-kotlin-part-5/">Ready for Part 5?</a></p>
<p>The post <a href="https://creatronix.de/learning-kotlin-part-4/">Learning Kotlin &#8211; Part 4 &#8211; conditionals</a> appeared first on <a href="https://creatronix.de">Creatronix</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
