Text tutorials 
1. Hello, World!

Hello World in TempleOS is very easy. It's only one line actually.
In this tutorial, you actually get to learn the basics of navigating
the terminal and make your first program.


Terminal commands{
DirMk("Tutorials"); //Create directory, also known as a folder.
Cd("Tutorials"); //Go into the newly created directory/folder.
Ed("Tutorial1.HC");//Create a new .HC file named Tutorial1 inside the current folder.
}

Code{
"Hello, World!/n";//Type "Hello, World!" in the current command line. "\n" character creates a new line.
}

When you are done writing your program, hit F5 to run it!
Play around with the text widgets by hitting <ctrl-l>. If 
anything were to go wrong, you can kill the program by
hitting <ctrl-shift-x> and you can focus on the next task
with <ctrl-alt-n>.

2. Input

Input in TempleOS can be a little tricky. In this tutorial, we only go
thruogh how to capture arrow keys input, which is captured diffrently 
from the others. If you want to learn more about input in TempleOS, I 
recommend using the Man() command to see where functions like ScanMsg()
are defined. TempleOS is 100% open source, even the kernel.

Code{
U0 Main()
{
I64 msg_code,arg1,arg2,sc,ch;
//I64 = Long.
try{
//try{} and catch{} cause all variables in a function do be non-reg.
 do{
  if(msg_code=ScanMsg(&arg1,&arg2,1<<MSG_KEY_DOWN)
  {
   ch=arg1;
   sc=arg2;
   switch(sc.u8[0])
   {
   //Arrow keys are stored diffrently from the other normal keys.
   /*Try adding your own cases with Char2ScanCode('x'), with x being
     a letter of your choise.*/
   case SC_CURSOR_LEFT:
   "Left\n";
   break;

   case SC_CURSOR_DOWN:
   "Down\n";
   break;

   case SC_CURSOR_UP:
   "Up\n";
   break;

   case SC_CURSOR_RIGHT:
   "Right\n";
   break;

   }while(ch!=CH_ESC&&ch!=CH_SHIFT_ESC);
  }catch;
 }
Main; //No parenthesis required if the function has no parimiters
} 


If you don't want to go in depth about input, you can skip this part.
The average TempleOS programmer wont have to think too much about this,
so please don't let all this text scare you away.


 Why is the msg_code declaration in an if statement?

 First of all, the 1<<MSG_KEY_DOWN is a flag we give to ScanMsg.
 If ScanMsg detects that no message fits the mask,
 it immediatly returns FALSE. 
 The first perimeter in ScanMsg is ASCII, (those starting in CH), and the second is
 scan_code(those starting in SC).

 Why do we detect arrow keys diffrently?

 If you want to go even more in depth about input, check out "::/Doc/CharOverview.DD".
 The short answer is that a char,or a U8 as it's known in TempleOS, has 
 it's code in the 4th byte, which is how most input is stored. Arrow keys
 and numpad keys are stored diffrently.