Skip to content

Instantly share code, notes, and snippets.

@enigmatic7earth
Last active January 17, 2019 13:15
Show Gist options
  • Save enigmatic7earth/52162974b93fa32b52f8bed3419f7984 to your computer and use it in GitHub Desktop.
Save enigmatic7earth/52162974b93fa32b52f8bed3419f7984 to your computer and use it in GitHub Desktop.
Beginner Dartpad
<!DOCTYPE html>
<html>
<head>
<title>A Beginner Dartpad- enigmatic7earth</title>
<script defer src="main.dart.js"></script>
</head>
<body>
<p id="Sample">
Sample paragraph.
</p>
</body>
</html>
void main() {
print("Hello, World of Dart");
print("----------Data Types----------");
int a = 7;
double b = 3.5;
num c = 45;
num d = 4.5;
print("A = "'$a'+" B = "'$b'+" C = "'$c'+" D = "'$d');
print("A is of type: "+ a.runtimeType.toString() + " with value :" + a.toString());
print("B is of type: "+ b.runtimeType.toString() + " with value :" + b.toString());
print("C is of type: "+ c.runtimeType.toString() + " with value :" + c.toString());
print("D is of type: "+ d.runtimeType.toString() + " with value :" + d.toString());
String language = "Dart";
print('I\'m learning the $language language');
bool flag = false;
print('Flag = $flag , type:'+flag.runtimeType.toString());
print("----------Variables----------");
var x = "X-Men";
print('Varible x has a value of $x and type :'+ x.runtimeType.toString());
print("----------Parsing----------");
var xa = "1";
int numxa = int.parse(xa);
print('XA = $xa , type:'+xa.runtimeType.toString());
print('NUMXA after int.parse(xa) = $numxa type:'+numxa.runtimeType.toString());
print("--------------------");
var xb = 55.55;
String strxb = xb.toString();
print('XB = $xb , type:'+xb.runtimeType.toString());
print('STRXB after xb.toString() = $strxb type:'+strxb.runtimeType.toString());
print("----------Lists----------");
var list = [1,1.23,"abc", false];
print('List = $list type:'+list.runtimeType.toString());
print("----------Maps----------");
var map = {
"name":"Andre",
"age":45
};
print('Map = $map type:'+map.runtimeType.toString());
print("----------Functions----------");
double res = getSquare(11.0);
print('RES = $res type:'+res.runtimeType.toString());
}
double getSquare(double x){
return x*x;
}
#Sample {
font-size: 20px;
font-family: 'Open Sans', sans-serif;
text-align: center;
margin-top: 20px;
background-color: SlateBlue;
color: Yellow;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment