So I found this using 2 to the power of >= 31
Carlos
checoimg at gmail.com
Wed Jun 12 19:22:40 PDT 2013
On Thursday, 13 June 2013 at 02:03:35 UTC, Jonathan M Davis wrote:
> 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
Great! Thanks!
I would use another space before the ":" .
writefln("%s : %s", 2^^count, count);
More information about the Digitalmars-d-learn
mailing list