<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://ocr.michiyo.me/w/index.php?action=history&amp;feed=atom&amp;title=Tutorial%2Foc2_writing_code</id>
	<title>Tutorial/oc2 writing code - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://ocr.michiyo.me/w/index.php?action=history&amp;feed=atom&amp;title=Tutorial%2Foc2_writing_code"/>
	<link rel="alternate" type="text/html" href="https://ocr.michiyo.me/w/index.php?title=Tutorial/oc2_writing_code&amp;action=history"/>
	<updated>2026-08-24T15:13:30Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.9</generator>
	<entry>
		<id>https://ocr.michiyo.me/w/index.php?title=Tutorial/oc2_writing_code&amp;diff=1372&amp;oldid=prev</id>
		<title>imported&gt;OCDoc Import: Imported from legacy OpenComputers documentation at ocdoc.cil.li</title>
		<link rel="alternate" type="text/html" href="https://ocr.michiyo.me/w/index.php?title=Tutorial/oc2_writing_code&amp;diff=1372&amp;oldid=prev"/>
		<updated>2026-08-24T08:08:27Z</updated>

		<summary type="html">&lt;p&gt;Imported from legacy OpenComputers documentation at ocdoc.cil.li&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= OC Tutorial: Writing Code =&lt;br /&gt;
&lt;br /&gt;
So, you&amp;#039;ve [[Tutorial/oc1 basic computer|built your first computer]] and wonder what to do with it?&lt;br /&gt;
&lt;br /&gt;
Well, let&amp;#039;s start with the good old, proven, beloved first program. You know which one. First off, let&amp;#039;s switch to the `/tmp` folder, which is a small, writable file system each computer comes with. Remember, this gets &amp;#039;&amp;#039;wiped on reboot&amp;#039;&amp;#039;, so don&amp;#039;t put anything valuable in here!&lt;br /&gt;
&lt;br /&gt;
[[File:https://i.imgur.com/7YdcUbE.png|700px|https://i.imgur.com/7YdcUbE.png]]&lt;br /&gt;
&lt;br /&gt;
As shown in the image, type `edit &amp;lt;filename&amp;gt;`, where `filename` is the name of the file you wish to edit. The `.lua` extension is absolutely optional, I just like to keep it for syntax highlighting when opening the files in an external editor.&lt;br /&gt;
&lt;br /&gt;
Once in the editor, start coding. In our case it&amp;#039;s just the boring, uncreative-but-proven `print(&amp;quot;Hello World!&amp;quot;)`.&lt;br /&gt;
&lt;br /&gt;
[[File:https://i.imgur.com/5F16EEV.png|700px|https://i.imgur.com/5F16EEV.png]]&lt;br /&gt;
&lt;br /&gt;
When you&amp;#039;re done, press Ctrl+S to save, then press Ctrl+W to close the editor. If you list the contents of the `/tmp` folder now, you&amp;#039;ll see the file has been created. Type its name and press enter to run it:&lt;br /&gt;
&lt;br /&gt;
[[File:https://i.imgur.com/KiHVUMu.png|700px|https://i.imgur.com/KiHVUMu.png]]&lt;br /&gt;
&lt;br /&gt;
Notice that I didn&amp;#039;t type the `.lua` extension when running it. The shell will look for files with that extension if it can&amp;#039;t find the file with the exact name you specified.&lt;br /&gt;
&lt;br /&gt;
If want your programs to survive reboots, &amp;#039;&amp;#039;&amp;#039;continue by reading on [[Tutorial/oc3 hard drives|how to use hard drives]]&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
== Contents ==&lt;br /&gt;
&lt;br /&gt;
{{:Tutorial/contents}}&lt;br /&gt;
&lt;/div&gt;</summary>
		<author><name>imported&gt;OCDoc Import</name></author>
	</entry>
</feed>