[phobos] readf for the novice
Jesse Phillips
jesse.k.phillips at gmail.com
Sat Sep 11 14:41:13 PDT 2010
There was a newsgroup post on this subject the beginning of this month
and it didn't get much feedback, other than a couple "sounds good to
me"
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=115470
I offered to clean up my implementation. There are some things I need
to experiment with and choose what would be best. And most importantly
I need to find out if it would be considered a good addition to
Phobos. The below code is an example of the functions and their usage:
import std.interact;
void main() {
auto age = userInput!int("Please Enter you age");
if(userInput!bool("Do you want to continue?"))
{
auto outputFolder = pathLocation("Where you do want to place
the output?");
auto color = menu!string("What color would you like to use?",
["Blue", "Green"]);
}
auto num = require!(int, "a > 0 && a <= 10")("Enter a number from 1 to 10");
}
Opinions?
--
Liberty means responsibility. That is why most men dread it.
- George Bernard Shaw
-------------- next part --------------
A non-text attachment was scrubbed...
Name: interact.d
Type: text/x-dsrc
Size: 4963 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/phobos/attachments/20100911/8ff084c6/attachment.d>
More information about the phobos
mailing list