It may be useful to allow declaring variables without type

Adam D. Ruppe via Digitalmars-d digitalmars-d at puremagic.com
Wed Jun 10 10:50:16 PDT 2015


On Wednesday, 10 June 2015 at 17:19:30 UTC, Binarydepth wrote:
> Hi, If it is not much trouble, care to explain how ?

If it is user input, take it in the format they send it. Like:

string typed_data;

if(isNumeric(typed_data)) {
    auto number = to!int(typed_data);
    // do stuff with humber
} else {
    // treat it as a string still
}


This tends to be the way I'd do it in python or ruby too.


More information about the Digitalmars-d mailing list