Docly Developers
Function Keyword Updated 17 Oct 2026

return value

Ends the current function and returns a value to the caller. A bare return; returns undefined.

Parameters

valueanyrequired

Value to return

Returns

Exits the function and returns the value. In a #/API file, the value returned from the exported function is sent to the client as JSON.

Example

Normal JavaScript, running in the browser or on the Docly™ server.
function add(a, b) {
    return a + b; // Exits the function and returns the sum
}

write(add(2, 3)); // Outputs 5