I'm sorry just a stupid question, I need to get the negative value of a number, for example
20 i need -20 35 o need -35 89 .... -89
I can't remember the operator
I'm sorry just a stupid question, I need to get the negative value of a number, for example
20 i need -20 35 o need -35 89 .... -89
I can't remember the operator
If you need a negative number, just add -
before it. For example (untested, but 95% sure it will work):
var number = 10
print (number) # prints 10
print (-number) # should print -10
print (number * -1) # should print -10
-my_number
is the reverse of your number. Would also turn a negative number positive.
@Kequc said:
-my_number
is the reverse of your number. Would also turn a negative number positive.
True! If you want to ensure the number will be negative and not turned positive, you want to add a condition first:
if (number > 0):
number = -number # make it negative!
sorry, no the problem was a bit more complicated but I solved it using another var thanks :)