Cloud Code scripts return results by simply "stating" the object to be returned by the Rhino engine.
Note how the CalculateArea script below is returning its result.
// First get our parameters
var width = data.width;
var height = data.height;
// Calculate the area
var result = width * height;
// Return the result
Your feedback is important to us. Please rate this response below. Thanks!