dart:core
庫中num.remainder
方法的用法介紹如下。
用法:
num remainder(
num other
)
this
除以 other
的餘數。
此操作的結果 r
滿足:this == (this ~/ other) * other + r
。因此,餘數 r
與除法器 this
具有相同的符號。
結果是 int ,如 int.remainder 所述,如果此數字和 other
都是整數,否則結果是 double 。
例子:
print(5.remainder(3)); // 2
print(-5.remainder(3)); // -2
print(5.remainder(-3)); // 2
print(-5.remainder(-3)); // -2
相關用法
- Dart num.sign用法及代碼示例
- Dart num.abs用法及代碼示例
- Dart num.compareTo用法及代碼示例
- Dart num.operator_modulo用法及代碼示例
- Dart num.toStringAsExponential用法及代碼示例
- Dart num.parse用法及代碼示例
- Dart num.toStringAsPrecision用法及代碼示例
- Dart num.tryParse用法及代碼示例
- Dart num.toStringAsFixed用法及代碼示例
- Dart num.toString用法及代碼示例
- Dart num.clamp用法及代碼示例
- Dart MapMixin.containsKey用法及代碼示例
- Dart Iterator用法及代碼示例
- Dart AttributeClassSet.intersection用法及代碼示例
- Dart TransformList.last用法及代碼示例
- Dart FileList.first用法及代碼示例
- Dart CanvasRenderingContext2D.drawImageScaledFromSource用法及代碼示例
- Dart FileList.length用法及代碼示例
- Dart Iterable.takeWhile用法及代碼示例
- Dart LinkedHashMap用法及代碼示例
- Dart RegExp.pattern用法及代碼示例
- Dart StreamTransformer構造函數用法及代碼示例
- Dart JsArray.removeAt用法及代碼示例
- Dart ListMixin.expand用法及代碼示例
- Dart UriData.parse用法及代碼示例
注:本文由純淨天空篩選整理自dart.dev大神的英文原創作品 remainder method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。