forked from akkupy/codeDump
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path03_String.dart
31 lines (26 loc) · 860 Bytes
/
03_String.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
void main()
{
//Literals
var isCool=true;
int k=1;
"John";
9.1;
//varius ways to define string literals in dart
String s1= 'single';
String s2= "double";
String s3= 'It\'s easy';
String s4= "Its easy";
String s5= 'This is going to be a very long string.' //+
'This is just sample demo in dart programming launguage';
//+ is optional
//string interpolation : use ["my name is $name"] instead of["my name is"+name]
String name="Neha";
//String message ="My name is $name"; //+ name;
print("My name is $name");
print("The number of characters in $name is ${name.length}.");
// whatever is written in curly brackets is treated as expressions.
int l=20;
int b=10;
print("The sum of $l and $b is ${l+b}");
print("The area of rectangle with length $l and breadth $b is ${l*b}");
}