# Function node - what happens if I don't "return" anything?

**URL:** https://discourse.nodered.org/t/function-node-what-happens-if-i-dont-return-anything/7457
**Category:** General
**Created:** [1 February 2019 05:21 UTC](https://discourse.nodered.org/t/function-node-what-happens-if-i-dont-return-anything/7457 "2019-02-01T05:21:21Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [1 February 2019 05:21 UTC](https://discourse.nodered.org/t/function-node-what-happens-if-i-dont-return-anything/7457/1 "2019-02-01T05:21:21Z")

</div>

I know I am asking for it by asking, but in light of wanting to learn.....

It probably isn't the reason, but I want to be sure.

My poor RPI is (I am told) running way to hard (60-70% load peaking.)  
Now and then it goes up to 100% but only for a while.

Anyway, here's my question:

(Example code only)  
(Hand written not real code, but only for showing the problem as I see it)

```auto
var x = msg.payload;
if (x == "foo")
{
   msg.payload = "Option 1";
  return msg;
}
else
if (x == "boo")
{
  msg.payload = "Option 2";
  return msg;
}

```

Which has not worried me until now.

If the message is neither "foo" or "boo" then nothing is sent.  
That is what is wanted/needed.

Until know I thought (stupidly) that you had to `return msg;`

But a simple `return` is also allowed.  
Though I have to admit, I don't get what is returned.

If I have a few (dozen) nodes without the final `return` would that cause problems?

Gotta ask to be sure.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [1 February 2019 07:00 UTC](https://discourse.nodered.org/t/function-node-what-happens-if-i-dont-return-anything/7457/2 "2019-02-01T07:00:34Z")

</div>

A return by itself, return null, and no return at the end at all, all do the same, no message is sent.

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [1 February 2019 07:01 UTC](https://discourse.nodered.org/t/function-node-what-happens-if-i-dont-return-anything/7457/3 "2019-02-01T07:01:31Z")

</div>

Ok, that resolves that suspicion.

---

<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: [1 February 2019 09:21 UTC](https://discourse.nodered.org/t/function-node-what-happens-if-i-dont-return-anything/7457/4 "2019-02-01T09:21:09Z")

</div>

> [@Trying\_to\_learn](#):
>
> Gotta ask to be sure.

Easily tested though - you need to have confidence in your ability to test 🙂

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [1 February 2019 09:26 UTC](https://discourse.nodered.org/t/function-node-what-happens-if-i-dont-return-anything/7457/5 "2019-02-01T09:26:06Z")

</div>

Yeah, as someone once said:

(this applies to me....)

 ![alberteinstein1-2x](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/6/6fcc5cc7fe8b826a318ecc2671e69b0f837c0994.jpeg)

I am good at testing dumb things I do.

But, I try to see the bright side of it. I am learning.
