# How do you multiply with zero as the same as using one?

Hello, how would I multiply something the same way that you can multiply something by one?
Example: 1 * 8 = 8 but with zero it becomes zero. Is there a workaround for this? Could you just do + 1 to the end result?

Is this what you’re asking for?

``````local function multiply(a: number, b: number): number
local product = a * b
if product == 0 then
return 1
else
return product
end
end
``````

I’m confused by what you’re asking

I am making a simulator game where there is rebirths to restart and start over but with a bonus, and that bonus is 2x what you had before. But when they join the game they’ll see they have 1 rebirth because you can’t multiply by 0. Is there a way you could make the amount be zero but not make the multiplied output be zero?

I’m pretty sure you need to add 1 to keep it at a flat rate. You can think of 1 as 100% of the bonus, aka the original value. You can apply the formula

1 + (rebirth amount * some bonus)

to add to the original amount.

But I want the players to see 0 rebirths instead of 1 because then they would think they have one. But you can’t multiply by 0.

In that case, you should have a separate variable to track how many rebirths the player has.

Well yeah, maybe I could just remove 1 from the value so it looks like zero but it’s actually 1 in the script.

1 + (rebirth amount * some bonus)

I have already provided a formula you can use where you do not need to remove 1 from the value. You can set the GUI to have the text of “rebirth amount” while still maintaining the function you wanted to have. Although, you might be correct about subtracting 1 if the rebirth is greater than 0.