Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import std.stdio;
- void main()
- {
- pure bool leapYear(uint y)
- {
- auto result = (y % 4) == 0 && (y % 100 || (y % 400) == 0);
- if (result) writeln(y, " is a leap year!"); // Error!
- // Cannot call impure function writeln from pure function!
- return result;
- }
- leapYear(1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement