Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Assert
Message
From
22/08/2003 15:51:02
 
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Title:
Re: Assert
Miscellaneous
Thread ID:
00822717
Message ID:
00822737
Views:
12
>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.
Previous
Reply
Map
View

Click here to load this message in the networking platform