Advertisement
Hiteshw11

Performing Modulus Operation Using Generic Function

Nov 29th, 2024
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 0.17 KB | Source Code | 0 0
  1. void main() {
  2.  var c = Modder();
  3.   print(c.modfunc<int>(10,5));
  4. }
  5.  
  6. class Modder
  7. {
  8.  
  9. Modder();
  10.  
  11. T modfunc<T extends num>(T a,T b)
  12. {
  13.  
  14. return (a%b) as T;
  15. }
  16.  
  17.  
  18. }
Tags: dart
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement