# Negatives in coding. (Solved & thanks for answering all my questions)

How do I make a variable negative in coding. I need to make this negative I was thinking of subtracting it by itself twice but that doesn’t work

In your number, put - sign like -15, instead of minus 15.

well I want to do that but the variable is determined by a property

What’s cash amount? A property? Sorry, I’m not that good at this stuff, but I know who is. @HAIASI

the cash amount is the variable that I made, its only used in this coding but would this work?

the properties are in green

Use math blocks to set a different variable to (multiply property by two), then set the older variable to (property - variable 2)

3 Likes

Ahh, the McDonald’s worker who receives a lot of likes but doesn’t give that many knows how to do it!

yeah it worked! thanks a lot @NavyCatZ

Off-topic and a bit mean.
People can use their likes however they want here.

I don’t mind at all and I just want to show you all I’ve done with your answers to all my questions! https://screencast.apps.chrome/1-an8BNChwWcdB2agQLEgF3GbUdZfjH9Z?createdTime=2023-12-22T02%3A34%3A48.306Z

1 Like

This game is basically going to be 4 islands surviving on what they have and advancing in there own ways then fighing eachother (basically bedwars but to get materials you have to do work)

Sorry, but I never said it was a bad thing.

1 Like

It just shows that NavyCatZ doesn’t farm for like badges and if you receive one, you know it’s meaningful.

1 Like

Sounds rly interesting! Btw, in the future when you need to do something like this just multiply the variable by -1 next time, I didn’t think of that and overcomplicated things lol

2 Likes

I updated my bio! Sorry, I forgot!

Oh sorry you didn’t over complicate anything you just helped. Thanks!

Instead of subtracting the number by 2 * itself , you could’ve done this for better optimization:

or this:

2 Likes

Wow I can’t believe you typed it all out in coding and I think it will be easier that way thanks!

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