Function problem

Hello, a noob here, I'm trying to create a function that outputs a true or false depending on the situation.

When the number is positive the output has to be false and when the number is negative the output has to be true.

I get "Function tried to send a message of type number" as output.

return msg;

The function must always return a msg object.

Now it outputs the same number as the input.

msg.payload = true

msg.payload = false

msg.payload = true , NOT msg.payload === true
Same for false

One = is an assignment msg.payload = "hello" (Make payload equal hello)
Two or three = is a comparison : msg.payload === "hello" (Does payload equal hello?)

1 Like

Thanks for helping a beginner steve, that worked.

1 Like

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