Re: The D language online tour - tour.dlang.org

2016-05-25 Thread marcpmichel via Digitalmars-d-announce
http://tour.dlang.org/ On the "Controlling flow" page, the first paragraph says : Sometimes you have to control your application's flow depending on input parameters. if, else and if else are your friends then: I think it's "if, else and else if are tour friends".

Re: legacy code retreat's triva game : the D version

2013-12-21 Thread marcpmichel
Do you mean I should have used : if (uniform(0,10) == 7) { instead ? TL;DR version: Actually, the equivalent would be uniform(0, 9), but yes, that'd be the preferable approach there. (also note https://github.com/jbrains/trivia/blob/7b473f9fbbd125b0ab1c2e82582b8a8c414ca501/d/source/trivia.d#L1

Re: legacy code retreat's triva game : the D version

2013-12-20 Thread marcpmichel
On Friday, 20 December 2013 at 15:05:07 UTC, bearophile wrote: marcpmichel: Here is the ugly thing : https://github.com/jbrains/trivia/tree/master/d And wrong: if (rand.front() % 9 == 7) { Bye, bearophile Do you mean I should have used : if (uniform(0,10) == 7) { instead ?

legacy code retreat's triva game : the D version

2013-12-20 Thread marcpmichel
I participated in the "global day of code retreat 2013", and we had to do refactoring on a very ugly piece of code which was available on many languages. But there was no D version, so I made one (based on the java version) and pull-requested it. Here is the ugly thing : https://github.com/j