fiqriachmada

Dart Anonymous Function

Feb 9th, 2021
639
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import 'dart:io';
  2.  
  3. String say(String from, String message, {String to, String appName}) {
  4.   return from + " say " + message + ((to != null) ? " to " + to : " ") + ((appName != null) ? " via " + appName : " ");
  5. }
  6.  
  7. String say2(String from, String message, [String to, String appName]) {
  8.   return from + " say " + message + ((to != null) ? " to " + to : " ") + ((appName != null) ? " via " + appName : " ");
  9. }
  10.  
  11. double luas_segiempat(double panjang, double lebar) => panjang * lebar;
  12.  
  13. main(List<String> arguments) {
  14.   Function f;
  15.   f = luas_segiempat;
  16.   print(say("Johny", "Hello", to: "Mada", appName: "WA"));
  17.   print(say2("Johny", "Hello", "Mada", "WA"));
  18.   print(f(6.0, 3.0));
  19. }
  20.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×