MKoD - D Programming Language

Basic D Examples / Tutorials - D BootCamp!

Basic Newbie Stuff List of Current Examples / Tutorials

"Hello World!" - a very basic NT/XP console example.
  • uses std.stdio.writefln()
  • the second example shows how to pass in arguments on the commandline
isValidSSN() - useful to validate an SSN.
  • uses, if..else if, and std.conv.toUint()
  • includes isDigits() to scan for a string for digits only
getIssusingState() - returns the state that issued for this SSN.
  • uses the foreach loop, and a static array of struct
isaac() - a 32-bit general purpose pseudo-random number generator.
  • uses for..loops,, and if..else statements
windchill() - returns windchill degrees by using the current temperature and windspeed together.
  • uses if..else statements, and the std.math.sqrt() function
  • includes convertFahrenheit2Celsius() and convertCelsius2Fahrenheit() to convert degrees.
getAshWednesday(), - The start of Lent, a period of fasting and prayer.
getPalmSunday(), - Jesus enters Jerusalem on a colt, many laid palms in the path before him.
getMaundyThursday(), - The Lord's Last Supper...and the day of the new commandment.
getGoodFriday(), - Jesus is crucified upon a cross at the hands of the Romans.
getEasterSunday(), - The day of Jesus' resurrection from the dead.
getAscensionThursday(), - The day of Jesus' ascension into Heaven.
getPentecost() - The day when the Holy Spirit descended upon the Apostles and others.
  • Note: all return the month and day for a given year from 1583 to 4099.
  • uses if..else statements
toSoundex() - returns the soundex code for a given string which is based upon its phonetic sound. getDoubleMetaphone() - returns one or two phonetic encodings for the word..
  • Note: A port of Lawrence Philips' Double-Metaphone Algorithm from CUJ June 2000 for D
  • uses an embedded function - addMetaph()
  • uses for..loops,, and if..else statements
  • includes doesAnyStringMatchAt(), isVowelAt(), isSlavoGermanic() and getCharAt() functions.
findPrimes() - returns a list of prime numbers.
  • Note: A port of Steve Litt's findPrimes() C example to D
  • uses for..loops, while..loops, and if..else statements
Mars: fourth Rock from the Sun.