Skip to content

Instantly share code, notes, and snippets.

View run-dlang's full-sized avatar

Eleanor Cross run-dlang

View GitHub Profile
@run-dlang
run-dlang / main.d
Created October 5, 2023 10:53
Code shared from run.dlang.io.
import std;
void main()
{
    real x = 3.14159265358979323846364e300;
    double y = -3.14159265358979323846364e3000L;
    float z = -3.14159265358979323846364e30;
       
 
   writefln ("x = %.1g",x);
   writefln ("y = %.2f",y);
@run-dlang
run-dlang / main.d
Created October 4, 2023 21:27
Code shared from run.dlang.io.
import std;
void main()
{
string[] f(string s)
{
return s.map!(_ => [_,'-'].to!string).array;
}
writeln(f("Hello")); // extected output: ["H-","e-","l-","l-","o-"]
}
@run-dlang
run-dlang / main.d
Created October 4, 2023 16:22
Code shared from run.dlang.io.
import std;
void main()
{
int value = 05;
writeln("Is between: ",
(value >= 10) && (value < 20));
}
@run-dlang
run-dlang / main.d
Created October 4, 2023 15:44
Code shared from run.dlang.io.
import std;
struct Color
{
/// Color red value
ubyte r;
/// Color green value
ubyte g;
/// Color blue value
ubyte b;
@run-dlang
run-dlang / main.d
Created October 3, 2023 20:42
Code shared from run.dlang.io.
import std.traits;
import std.meta;
import std.typecons;
import std.stdio;
import std.conv;
import std.array;
import std.algorithm.iteration : map, joiner;
import std.ascii;
import std.string;
@run-dlang
run-dlang / main.d
Created October 3, 2023 20:40
Code shared from run.dlang.io.
private
{
import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.traits;
auto propertyGenerator(string name, string type) {
@run-dlang
run-dlang / main.d
Created October 3, 2023 13:01
Code shared from run.dlang.io. Run with '-unittest'
void main()
{
import std.algorithm, std.stdio;
"Starting program".writeln;
int[] a = new int[5];
a = [1, 5, 3, 6, 9];
@run-dlang
run-dlang / main.d
Created October 3, 2023 00:06
Code shared from run.dlang.io.
import std.algorithm;
import std.stdio, std.json;
void main()
{
 enum kıstas = "a < b";
 auto okulum = SIRALA!long(veri, "OKUL");
// The source of the sorted data-^ root-^
 okulum.school!kıstas.writeln;
@run-dlang
run-dlang / main.d
Created October 3, 2023 00:05
Code shared from run.dlang.io.
import std.algorithm;
import std.stdio, std.json;
void main()
{
 enum kıstas = "a < b";
 auto okulum = SIRALA!long(veri, "OKUL");
// The source of the sorted data-^ root-^
 okulum.school!kıstas.writeln;
@run-dlang
run-dlang / main.d
Created October 3, 2023 00:05
Code shared from run.dlang.io.
import std.algorithm;
import std.stdio, std.json;
void main()
{
 enum kıstas = "a < b";
 auto okulum = SIRALA!long(veri, "OKUL");
// The source of the sorted data-^ root-^
 okulum.school!kıstas.writeln;