Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 162
  • Last Modified:

how to change a possitive value to negative

Hello guys,

I have a variable with this value 145.74
I would like to change the value to - 145.74

To change from negative to possitive I can use ABS

and from possitive to negative ?

Thanks
0
hidrau
Asked:
hidrau
  • 2
  • 2
1 Solution
 
rfwoolfCommented:
0 - 145.74 ?
0
 
MerijnBSr. Software EngineerCommented:
var d: double;
begin
 d := 145.74;
 d := d * -1;
 // d is now -145.74
end;
0
 
rfwoolfCommented:
Thanks. You could have waited a little longer before accecpting your solution, because MerijnB's answer is also correct. Let us know if you need anything else :)
0
 
MerijnBSr. Software EngineerCommented:
don't understand, how does rfwoolf's answer change a value from positive to negative :)

I guess I misunderstand the question... :?
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now