So I found this using 2 to the power of >= 31
Jonathan M Davis
jmdavisProg at gmx.com
Wed Jun 12 19:03:22 PDT 2013
On Thursday, June 13, 2013 03:46:59 Carlos wrote:
> import std.stdio;
> import std.math : pow;
>
> void main()
> {
> cast(ulong)count;
That line won't compile.
> foreach (count; 1 .. 33){
> write((2)^^(count), " : ", count, "\n");
> }
> }
>
> same output.
If you want to set the type of count, then give it a type instead of letting
foreach infer it. Integeral literals are inferred to be int, so if you don't
give count a type, it'll be int.
import std.stdio;
import std.math : pow;
void main()
{
foreach(ulong count; 1 .. 33)
writefln("%s: %s", 2^^count, count);
}
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list