If and return

So if I don’t return a value at the end of the statement it gievs an error but if i do it has a fixed return value. is there any way to make it so that i dont return a value at the end?

Not in Blocks, no, since functions can only have a single return type. The standard mechanism for something like this is to return a sentinel value, like -999.

In TypeScript, you can fake it by declaring the return type as a union type:

function direction (multiplier: number): number | void {
...
}
3 Likes

yeah with the | isn’t that also bitwise or?