<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://miniscript.org/w/index.php?action=history&amp;feed=atom&amp;title=Debugging_Tips</id>
	<title>Debugging Tips - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://miniscript.org/w/index.php?action=history&amp;feed=atom&amp;title=Debugging_Tips"/>
	<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Debugging_Tips&amp;action=history"/>
	<updated>2026-04-07T10:28:20Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.0</generator>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Debugging_Tips&amp;diff=1064&amp;oldid=prev</id>
		<title>JoeStrout: /* Use the QA module */</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Debugging_Tips&amp;diff=1064&amp;oldid=prev"/>
		<updated>2023-01-04T03:54:06Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Use the QA module&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 03:54, 4 January 2023&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l30&quot; &gt;Line 30:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 30:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Use the QA module ===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Use the QA module ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In [[Mini Micro]] and [[Farmtronics]], there is a &amp;lt;c&amp;gt;qa&amp;lt;/c&amp;gt; (Quality Assurance) module in &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt; that may be &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;imported&lt;/del&gt;.  This provides functions like &amp;lt;c&amp;gt;abort&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;assert&amp;lt;/c&amp;gt;, and &amp;lt;c&amp;gt;assertEqual&amp;lt;/c&amp;gt;.  Add these to check your assumptions, for example:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In [[Mini Micro]] and [[Farmtronics]], there is a &amp;lt;c&amp;gt;qa&amp;lt;/c&amp;gt; (Quality Assurance) module in &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt; that may be &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[[import]]ed&lt;/ins&gt;.  This provides functions like &amp;lt;c&amp;gt;abort&amp;lt;/c&amp;gt;, &amp;lt;c&amp;gt;assert&amp;lt;/c&amp;gt;, and &amp;lt;c&amp;gt;assertEqual&amp;lt;/c&amp;gt;.  Add these to check your assumptions, for example:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* At the start of a function, assert that the function arguments are of the correct type and range.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* At the start of a function, assert that the function arguments are of the correct type and range.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Debugging_Tips&amp;diff=1063&amp;oldid=prev</id>
		<title>JoeStrout: /* Use the QA module */</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Debugging_Tips&amp;diff=1063&amp;oldid=prev"/>
		<updated>2023-01-04T03:53:31Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Use the QA module&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 03:53, 4 January 2023&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l30&quot; &gt;Line 30:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 30:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Use the QA module ===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Use the QA module ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In [[Mini Micro]] and [[Farmtronics]], there is a &amp;lt;c&amp;gt;qa&amp;lt;/c&amp;gt; (Quality Assurance) module in &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt; that may be imported.  This provides functions like &amp;lt;c&amp;gt;abort&amp;lt;/&amp;gt;, &amp;lt;c&amp;gt;assert&amp;lt;/c&amp;gt;, and &amp;lt;c&amp;gt;assertEqual&amp;lt;/c&amp;gt;.  Add these to check your assumptions, for example:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In [[Mini Micro]] and [[Farmtronics]], there is a &amp;lt;c&amp;gt;qa&amp;lt;/c&amp;gt; (Quality Assurance) module in &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt; that may be imported.  This provides functions like &amp;lt;c&amp;gt;abort&amp;lt;/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;c&lt;/ins&gt;&amp;gt;, &amp;lt;c&amp;gt;assert&amp;lt;/c&amp;gt;, and &amp;lt;c&amp;gt;assertEqual&amp;lt;/c&amp;gt;.  Add these to check your assumptions, for example:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* At the start of a function, assert that the function arguments are of the correct type and range.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* At the start of a function, assert that the function arguments are of the correct type and range.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Debugging_Tips&amp;diff=1062&amp;oldid=prev</id>
		<title>JoeStrout at 03:51, 4 January 2023</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Debugging_Tips&amp;diff=1062&amp;oldid=prev"/>
		<updated>2023-01-04T03:51:49Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 03:51, 4 January 2023&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l26&quot; &gt;Line 26:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 26:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Use stackTrace ===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Use stackTrace ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;When your program breaks with an error message while running, use the [[stackTrace]] command to see how it got into that state.  (Available in [[Mini Micro]] and [[Farmtronics]].&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;When your program breaks with an error message while running, use the [[stackTrace]] command to see how it got into that state.  (Available in [[Mini Micro]] and [[Farmtronics]].&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;)&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Use the QA module ===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Use the QA module ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
	<entry>
		<id>http://miniscript.org/w/index.php?title=Debugging_Tips&amp;diff=1061&amp;oldid=prev</id>
		<title>JoeStrout: Created page with &quot;When a program does not perform as intended, we say it has one or more ''bugs'' (defects).  The art of tracking down and fixing these defects is known as ''debugging''.  This...&quot;</title>
		<link rel="alternate" type="text/html" href="http://miniscript.org/w/index.php?title=Debugging_Tips&amp;diff=1061&amp;oldid=prev"/>
		<updated>2023-01-04T03:50:13Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;When a program does not perform as intended, we say it has one or more &amp;#039;&amp;#039;bugs&amp;#039;&amp;#039; (defects).  The art of tracking down and fixing these defects is known as &amp;#039;&amp;#039;debugging&amp;#039;&amp;#039;.  This...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;When a program does not perform as intended, we say it has one or more ''bugs'' (defects).  The art of tracking down and fixing these defects is known as ''debugging''.&lt;br /&gt;
&lt;br /&gt;
This page presents some tips for debugging Mini Micro programs.&lt;br /&gt;
&lt;br /&gt;
=== Check Your Assumptions ===&lt;br /&gt;
&lt;br /&gt;
Most bugs are fundamentally the result of something you believe or assume, which is not actually true.  As you go over your code, look for ways to check your assumptions.  (The methods below can help.)&lt;br /&gt;
&lt;br /&gt;
=== Print to the screen ===&lt;br /&gt;
&lt;br /&gt;
To verify that your code is doing what you think it's doing, it's often helpful to use &amp;lt;c&amp;gt;[[print]]&amp;lt;/c&amp;gt; liberally.&lt;br /&gt;
&lt;br /&gt;
To check the results of some frequent (e.g. every-frame) calculation, sometimes it's helpful to print this in the same part of the screen as a constantly-updating display.  For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ms&amp;gt;text.row = 25&lt;br /&gt;
print &amp;quot;Mouse: &amp;quot; + mouse.x + &amp;quot;,&amp;quot; + mouse.y + &amp;quot; &amp;quot; * 30&amp;lt;/ms&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(The extra &amp;lt;c&amp;gt;&amp;quot; &amp;quot; * 30&amp;lt;/c&amp;gt; pads the output with spaces for cases where the new output is shorter than the previous output.)&lt;br /&gt;
&lt;br /&gt;
=== Print to a log list ===&lt;br /&gt;
&lt;br /&gt;
If your debug output is too long and complex to see on screen, or the text display is hidden or too busy to allow this, then you can instead log your output to a list.  Just put &amp;lt;c&amp;gt;debugOut = []&amp;lt;/c&amp;gt; at the start of your program, and whenever you have anything interesting to note, push it onto this list, e.g. &amp;lt;c&amp;gt;debugOut.push &amp;quot;Starting calculation at &amp;quot; + time&amp;lt;/c&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Then, after stopping your program, you can inspect this in various ways.  The &amp;lt;c&amp;gt;pageThrough&amp;lt;/c&amp;gt; function (defined in &amp;lt;c&amp;gt;/sys/lib/startup.ms&amp;lt;/c&amp;gt;) may be helpful.  For example, to page through the last 100 lines of your debug output, you would do &amp;lt;c&amp;gt;pageThrough debugOut[-100:]&amp;lt;/c&amp;gt;.  Or, write to a file with &amp;lt;c&amp;gt;file.writeLines &amp;quot;debug.txt&amp;quot;, debugOut&amp;lt;/c&amp;gt;, then inspect the resulting file with a text editor.&lt;br /&gt;
&lt;br /&gt;
=== Use stackTrace ===&lt;br /&gt;
&lt;br /&gt;
When your program breaks with an error message while running, use the [[stackTrace]] command to see how it got into that state.  (Available in [[Mini Micro]] and [[Farmtronics]].&lt;br /&gt;
&lt;br /&gt;
=== Use the QA module ===&lt;br /&gt;
&lt;br /&gt;
In [[Mini Micro]] and [[Farmtronics]], there is a &amp;lt;c&amp;gt;qa&amp;lt;/c&amp;gt; (Quality Assurance) module in &amp;lt;c&amp;gt;/sys/lib&amp;lt;/c&amp;gt; that may be imported.  This provides functions like &amp;lt;c&amp;gt;abort&amp;lt;/&amp;gt;, &amp;lt;c&amp;gt;assert&amp;lt;/c&amp;gt;, and &amp;lt;c&amp;gt;assertEqual&amp;lt;/c&amp;gt;.  Add these to check your assumptions, for example:&lt;br /&gt;
&lt;br /&gt;
* At the start of a function, assert that the function arguments are of the correct type and range.&lt;br /&gt;
* After calling a function, assert that the returned value is what you expect.&lt;br /&gt;
* Validate a complex data structure, and call &amp;lt;c&amp;gt;abort&amp;lt;/c&amp;gt; if anything fails to add up.&lt;br /&gt;
&lt;br /&gt;
When an assertion fails or &amp;lt;c&amp;gt;abort&amp;lt;/c&amp;gt; is explicitly called, the &amp;lt;c&amp;gt;qa&amp;lt;/c&amp;gt; module will display the error and a traceback, in red text over a dark (but translucent) background.  This lets you know immediately that there was a problem, something about what the problem was, and where it occurred.  You can enter &amp;lt;c&amp;gt;qa.clear&amp;lt;/c&amp;gt; to clear this error display.&lt;br /&gt;
&lt;br /&gt;
[[Category:How To]]&lt;/div&gt;</summary>
		<author><name>JoeStrout</name></author>
		
	</entry>
</feed>