Saturday, February 20, 2021

Dart Language sample program with variables,data types,expansion of variables inside quotes, final and const keywords

 

Sample program
main(List<String> arguments){
//variables loosely typed.
var country = 'sdfsdf';
print(country);

//variables strongly typed
String name;
name = "dfdsf";
num age=13;
int age1 = 14;
double n2=23.34;
bool isTrue = true;
print("$name ${lastName.toUpperCase()} is $age ");//expansion of variables inside quotes.
}

//String,Number(integers and doubles),Boolean(1 or 0.true or false),lists,maps

final(always constant) and const(constant at compile time)
const pi=3.14;



online code editor:
dartpad.dartlang.org

language guide
https://www.dartlang.org/guides/language/language-tour

coding style or conventions:
https://dart.dev/guides/language/effective-dart/style

No comments:

Post a Comment