# Void function() inside a function node

**URL:** <https://discourse.nodered.org/t/void-function-inside-a-function-node/76206>\
**Category:** General\
**Tags:** function-node\
**Created:** [7 March 2023 00:56 UTC](https://discourse.nodered.org/t/void-function-inside-a-function-node/76206 "2023-03-07T00:56:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rchandrashekar53](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rchandrashekar53/32/60423_2.png) [@rchandrashekar53](https://discourse.nodered.org/u/rchandrashekar53)\
**Post date:** [7 March 2023 00:56 UTC](https://discourse.nodered.org/t/void-function-inside-a-function-node/76206/1 "2023-03-07T00:56:32Z")

</div>

Hi,

I have a question - i have a nested if-else block and majority of the implementation within the block have similar lines of code.

Is there a way how i can have a void function() within a function block? i did try but i get an error in creating a void function.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [7 March 2023 02:08 UTC](https://discourse.nodered.org/t/void-function-inside-a-function-node/76206/2 "2023-03-07T02:08:16Z")

</div>

Not sure what you mean by a void function, that isn't a JavaScript thing.

You can certainly put a function definition inside a function node.

```auto
function doThing() {
    return 'thing'
}

return {payload: doThing()}

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [6 May 2023 02:08 UTC](https://discourse.nodered.org/t/void-function-inside-a-function-node/76206/3 "2023-05-06T02:08:58Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
