This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main(){ | |
// literal | |
var isvalid = true; | |
var x = 2; | |
var value = 45.55; | |
"hello"; | |
//various way to define string literal in dart | |
String s1 = 'single'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Define a function | |
/* void main(){ | |
findperimeter(); | |
} | |
void findperimeter(){ | |
int length=4; | |
int breadth=5; | |
int perimeter= 2*(length+breadth); | |
print("the perimeter is $perimeter"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int | |
Integer values no larger than 64 bits. | |
double | |
64-bit (double-precision) floating-point numbers. | |
Both int and double are subtypes of num. The num type includes basic operators such as +, -, /, and *, and is also where you’ll find abs(), ceil(), and floor(), among other methods. | |
// String -> int | |
var one = int.parse('1'); |