Integer

protocol Integer : _Integer, Strideable
  • abs

    Returns the absolute value of self.

    (-1).abs    #=> 1
    (-2).abs    #=> 2
    (2).abs     #=> 2
    (0).abs     #=> 0
    

    Declaration

    Swift

    var abs: Self
  • An alias to Integer#abs, returns the absolute value of self.

    (-1).magnitude      #=> 1
    (-2).magnitude      #=> 2
    (2).magnitude       #=> 2
    (0).magnitude       #=> 0
    

    See

    See Also: Integer#abs

    Declaration

    Swift

    var magnitude: Self
  • Undocumented

    Declaration

    Swift

    protocol Integer : _Integer, Strideable