---
agentTools:
  projectIndex: https://nativescript-batch.readme.io/llms.txt
---

# setResult

Sets the initial result value.

[block:code]
{
  "codes": [
    {
      "code": "import Batch = require(\"nativescript-batch\");\n\nvar b = Batch.newBatch(function(ctx) {\n    console.log(\"Result: \" + ctx.result);  // 23979\n}).then(function(ctx) {\n    ctx.result = 5979;\n});\n\nb.batch.setResult(23979);\n\n// 5979\nvar r = b.batch.start();",
      "language": "javascript"
    }
  ]
}
[/block]