>Hi All:
> Can someone please show me how to use assert statement in debug.
>Thanks
>MA
ASSERT is checking if some expression evaluates to .F. and showing dialog with buttons for Debug, Cancel, Ignore, Ignore All.
Example:
SET ASSERTS ON
nA = 1
nB = 2
lCondition = nA > nB
IF lCondition = .T.
=MESSAGEBOX("ASSERT will not pass here!")
ENDIF
ASSERT lCondition MESSAGE "nA > nB = .F."
Program checks if nA is bigger then nB. If it is then lCondition = .T. otherwise lCondition = .F.
ASSERT is checking the value of lCondition and because it is .F. it shows up dialog for debuging options.
ASSERT is a nice way for trapping errors elegantly.
Be aware that ASSERT command will work only if SET ASSERTS is ON, otherwise is ignored.