Saturday, February 20, 2021

is !is optional arguments and return statement using =>

 int number=34;

print(number is int);

print(number is! bool);



function return values:


String showName(){

return "Hello from sdfdsf!";

}


String getName() => "James Bond"; //this function getName returns "James Bond"


surround with square brackets to keep the arguments optional.


string sayHello(String name,[String lastName],[int age]) => "Hello $name"

  "$lastName";


No comments:

Post a Comment