diff --git a/example.cfg b/example.cfg index b94762e..96ee9f4 100644 --- a/example.cfg +++ b/example.cfg @@ -1,6 +1,6 @@ # A 'tconfpy' Example Configuration File # Copyright 2003-2005 TundraWare Inc. -# $Id: example.cfg,v 1.106 2005/01/13 22:12:39 tundra Exp $ +# $Id: example.cfg,v 1.107 2005/01/14 09:53:18 tundra Exp $ # # This is designed to illustrate the various features # of the 'tconfpy' configuration language. @@ -230,6 +230,9 @@ bool1 = 0 bool1 = yessir # Error: Unrecognized boolean value + +# Testing Booleans - The HARD WAY + # No matter how you set it, the *value* of a boolean is always stored as # 'True' or 'False'. This matters when doing Comparison Conditionals @@ -249,3 +252,30 @@ .endif +# Testing Booleans - The EASY WAY + +# Quick Review: If you do this, you are testing to see if a boolean +# variable *exists*: +# +# .ifall/any/none BoolVar1 BoolVar2 .... +# +# Ordinarily, [foo] returns the *value* of variable 'foo'. But in the +# case of booleans in an existential test, this construct returns the +# *logical state* of the boolean variable. So you can do things like: + + +bool1 = True + +.ifany [bool1] + + bool1was True + +.else + + bool1was False + +.endif + +# This only works *within existential tests* (.ifany, .ifall, .ifnone). +# Everywhere else, [BoolVar] will return one of the strings, 'True' or 'False'. +