False doesn't fail
In some situations (e.g. debugging) it may be nice to trigger an error unconditionally. The following will not work since
erroris not possible withoutelse:While(exp, _):- error "Error" on expTherefore, I expected the following TS code to do the job:
While(exp, _):- where false else error "Error" on expBut
falsedoesn’t fail, therefore the error is not displayed.
A workaround is to instead use a condition that is known to be false.
Submitted by D. Pelsmaeker on 19 June 2014 at 12:03While(exp, _):- where exp == "xxxxxxxxx" else error "Error" on exp
Log in to post comments