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 main() { | |
Map myMap = { | |
1: 3, | |
'Peter': 5, | |
1.2: "hi", | |
}; | |
print(myMap[1]); // Will print 3. | |
print(myMap['Peter']); // Will print 5 | |
print(myMap[1.2]); // Will print "hi" |
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 main() { | |
var myList = [1, "Hello", 3, 4.4, 5]; | |
myList[2] = "World"; | |
for (int i = 0; i < 5; i++) { | |
print("${myList[i]} "); | |
} | |
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() { | |
greeting("Ram"); | |
print("The sum of 10 and 20 is ${add(10, 29)}."); | |
canWatchMovie(12); | |
greeting3(); | |
greeting3(name: "Lakshman"); | |
print("The ares of rectange of length 10 and width 20 is ${areaOfRectangle(length: 19, width: 20)}"); | |
} |
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() { | |
var myStr1 = "Elementary,"; | |
var myStr2 = "My dear Watson"; | |
var myInt = 221; | |
// String concatenation. | |
print(myStr1 + ' ' + myStr2 + '.'); | |
// String interpolation. |
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() { | |
// String with single quotes. | |
var myStr1 = 'I\'m gonna make him an offer he can\'t refuse.\n'; | |
// String with double quotes. | |
var myStr2 = "I'm the king of the world.\n"; | |
// Multi line string. | |
var myStr3 = ''' |
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() { | |
var myVar1 = "The one ring to rule them all."; // myVar1 will be of type String. | |
var myVar2 = 1; // myVar2 will be of type int. | |
var myVar3 = 1.1; // myVar3 will be of type double. | |
print(myVar1.runtimeType); | |
print(myVar2.runtimeType); | |
print(myVar3.runtimeType); | |
} |
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() { | |
dynamic myDynamicVar; | |
myDynamicVar = 10; | |
print(myDynamicVar); | |
myDynamicVar = 3.14; | |
print(myDynamicVar); | |
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
#ifndef __dbg_h__ | |
#define __dbg_h__ | |
#include <stdio.h> | |
#include <errno.h> | |
#include <string.h> | |
#ifdef NDEBUG | |
#define debug(M, ...) | |
#else |