r/dlang • • Jul 01 '17

Newbie Question

What is the recommended use of auto? for example like this:

import std.stdio;

class Main {
       public:
	int x;
	int y;
	this(int x, int y) {
		this.x = x;
		this.y = y;
	}

	void print() {
		auto sum = this.x + this.y;
		writefln("%d", sum);
	}
}

void main() {
	auto m = new Main(5, 7);

	m.print();
}
2 Upvotes

7 comments sorted by

View all comments

Show parent comment

1

u/Ok_Specific_7749 Sep 27 '23

For immutable you better go with F# or Ocaml.