// -------------------
import std.stdio;
void main(string[] args) {
writeln("Hello World!");
import std.stdio;
int main () {
/* local variable definition */
int a = 10;
/* while loop execution */
import std.stdio;
int main(string[] args) {
int a = 20;
int b = 10;
int c = 15;
int d = 5;
int e;
e = (a + b) * c / d;// ( 30 * 15 ) / 5
import std.stdio;
int main(string[] args) {
int a = 4;
short b;
double c;
int* ptr;
/* example of sizeof operator */
import std.stdio;
int main(string[] args) {
int a = 21;
int c ;
c =a;
writefln("Line 1 - =Operator Example, Value of c = %d\\n", c );
import std.stdio;
int main(string[] args) {
uint a = 60; /* 60 = 0011 1100 */
uint b = 13; /* 13 = 0000 1101 */
import std.stdio;
int main(string[] args) {
int a = 5;
int b = 20;
int c ;
if ( a && b ) {
writefln("Line 1 - Condition is true\\n" );
import std.stdio;
int main(string[] args) {
int a = 21;
int b = 10;
int c ;
if( a == b ) {
writefln("Line 1 - a is equal to b\\n" );
import std.stdio;
int main(string[] args) {
int a = 21;
int b = 10;
int c ;
c = a + b;
writefln("Line 1 - Value of c is %d\\n", c );
import std.stdio;
int main(string[] args) {
writefln("Hello\\tWorld%c\\n",'\\x21');
import std.stdio;
enum {
A = 1.2f,// A is 1.2f of type float
B,// B is 2.2f of type float
int C = 3, // C is 3 of type int
import std.stdio;
enum : string {
A = "hello",
B = "world",
}
int main(string[] args) {
import std.stdio;
// Initialized sun with value 1
enum { sun , mon, tue, wed, thu, fri, sat };
int main(string[] args) {
import std.stdio;
// Initialized sun with value 1
enum Days { sun = 1, mon, tue, wed, thu, fri, sat };
import std.stdio;
enum Days { sun, mon, tue, wed, thu, fri, sat };
int main(string[] args) {
Days day;
day = Days.mon;
import std.stdio;
int main() {
writeln("Length in bytes: ", char.sizeof);
return 0;
}
import std.stdio;
int main() {
writeln("Length in bytes: ", float.sizeof);
return 0;
}
// ---------------------
import std.stdio;
int main() {
writeln("Length in bytes: ", ulong.sizeof);
import std.stdio;
int a = 10, b = 10;
int c;
float f;
int main () {
writeln("Value of a is : ", a);
import std.stdio;
void main(string[] args) {
char[9] greeting1 = "Hello all";
writefln("%s",greeting1);
import std.stdio;
import std.uni;
void main() {
writeln("Is ğ lowercase? ", isLower('ğ'));
import std.stdio;
struct Rectangle {
double width;
double height;
double area() const @property {
return width*height;
import std.stdio;
inout(char)[] qoutedWord(inout(char)[] phrase) {
return '"' ~ phrase ~ '"';
import std.stdio;
import core.vararg;
void printargs(int x, ...) {
for (int i = 0; i < _arguments.length; i++) {
import std.stdio;
auto add(int first, double second) {
double result = first + second;
return result;
import std.stdio;
ref int greater(ref int first, ref int second) {
return (first > second) ? first : second;
import std.stdio;
int x = 10;
immutable int y = 30;
const int* p;
pure int purefunc(int i,const char* q,immutable int* s) {
import std.stdio;
int main () {
/* local variable definition */
int a = 100;
int b = 200;
switch(a) {
case 100:
import std.stdio;
int main () {
/* local variable definition */
char grade = 'B';
switch(grade) {
import std.stdio;
int main () {
/* local variable definition */
int a = 100;
int b = 200;
/* check the boolean condition */