On 7/30/2014 5:52 AM, "Ola Fosheim Grøstad"
<[email protected]>" wrote:
On Wednesday, 30 July 2014 at 09:12:56 UTC, bearophile wrote:
And assume() and assert() are two different things, used for different
purposes. Do not give the same name to two so different features, if you want
to keep a language sane.
Exactly. If you want to establish that the provided input is never zero and that
the program doesn't need to be correct in that case, you do this:
assume(input!=0);
If you want to specify that the input should be prevented from being zero, you
do this:
if(input!=0){
assert(input!=0);
}
Now you're trying to use assert to validate user input. This is a terrible,
terrible misunderstanding of assert.