The Swift Programming Language--

2015-06-16  本文已影响26人  ted005

Basic Operators

Remainder Operator. The sign of b is ignored for negative values of b. This means that a%b and a%-b always give the same answer.

  let remains = 8%2.5 // 0.5

++ and -- can be used for any integer and floating-point type.

  let minusSix = -6
  let alsoSix = +minusSix // -6, '+' does not do anything
上一篇 下一篇

猜你喜欢

热点阅读