Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR DART

Function in dart

//Function in Dart

import 'dart:html';

main(List<String> args) {
  func1();
  func2();
  func3(45, 6);
  print("Division 1:${func4()}");
  print("Division 2:${func5(22, 7)}");
  print(PrintMsg());
}

//Type- 1 no argument no return

void func1() {
  print("I am just learning Flutter FrameWork");
}

void func2() {
  var num1 = 12;
  var num2 = 45;
  var num3 = 0;
  num3 = num1 + num2;

  print("Sum $num3");
}

//Type-2  with argumnet with no return
void func3(var num1, var num2) {
  var num3 = 0;
  num3 = num1 * num2;
  print("Multiply:$num3");
}

//Type-3  no argument with return type

double func4() {
  var num1 = 22.0;
  var num2 = 7.0;
  var num3;

  num3 = num1 / num2;
  return num3;
}

//Type-4  with argument with return

double func5(var num1, var num2) {
  var num3;
  num3 = num1 / num2;
  return num3;
}

//Anamous Function
PrintMsg() => "I am just learning Flutter FrameWork";
Source by androidatc.com #
 
PREVIOUS NEXT
Tagged: #Function #dart
ADD COMMENT
Topic
Name
3+1 =