Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Assert
Message
De
22/08/2003 15:51:02
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Titre:
Re: Assert
Divers
Thread ID:
00822717
Message ID:
00822737
Vues:
11
>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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform