VOOZH about

URL: https://www.geeksforgeeks.org/ruby/ruby-float-class-value-6/

⇱ Ruby | Float class -@ value - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Ruby | Float class -@ value

Last Updated : 7 Jan, 2020
Float#-@() : -@() is a Float class method in Ruby which return its own self value. It works as -@a = -(a)
Syntax:  Float.-@()

Parameter: Float value

Return:  Negative Self
Code #1 : Example for -@() method Output :
-@a : 111.10000000000001

-@b : 200000.0

-@c : 116.4
Code #2 : Example for -@() method Output :
-@a : 56.23333333

-@b : -10000.0

-@c : 29.1
Comment