Simple test programs

The MonkeyC Programmer's Guide has several examples where there is a simple main program and none of the emulator stuff, like so (taken from page 18)

function add(a, b)
{
return a + b;
}

function main()
{
var a = add(1, 3); // Returns 4
var b = add("Hello ", "World"); // Returns "Hello World"
}


It is possible to build and execute such a simple program? I'm guessing so, but it just isn't documented and isn't being made easy. I ask because it would make testing code that depends only on the MonkeyC language (and not on the ConnectIQ API) much easier.

Travis
  • It is not possible to have a simple program like the one in the Programmer's Guide. All Connect IQ apps must inherit from Toybox.Application.AppBase and must return an array containing a Toybox.WatchUi.View from getInitialView(). We'll update the sample in the Programmer's Guide to remove the confusion.