Advertisement
AnasB

Dart3

Jun 3rd, 2021
963
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. num absu(num x){
  2.   if(x<0){
  3.     return -1*x;
  4.   }
  5.   else{
  6.     return x;
  7.   }  
  8. }
  9. void main() {
  10.   var result=absu(1);
  11.   print(result);
  12. }
  13. --------------------
  14. void newPrint(){
  15.   print("Function called");
  16. }
  17.  
  18. // num sum(num x, num y){
  19. //   return  x+y;
  20. // }
  21.  
  22. num sum(num x, num y)=> x+y;
  23.  
  24. // Driver code
  25. void main() {
  26.  
  27.   //calling newPrint
  28.   newPrint();
  29.   newPrint();
  30.  
  31.   //calling sum
  32.   var result=sum(1,2); //print(sum(1,2));
  33.   print(result);
  34. }
  35. -----------------
  36. num square (num x)=> x*x;
  37.  
  38. num squareSum(num x, num y)=>
  39.   square(x) + square(y);
  40.  
  41. void main(){
  42.   var result = squareSum(3,2);
  43.   print (result);
  44. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement