True is a [boolean] value. It is recognised by [expr]. 1. True values are '''yes''', '''on''', '''true''', their ''unique'' abbrevations, and non-zero integers, 2. False values are '''no''', '''off''', '''false''', their ''unique'' abbrevations, and the integer '''0'''. The function '''[string is] true''' returns true if its argument obeys the condition 1. above (and '''[string is] false''' does the opposite). Unless the '''-strict''' flag is passed both '''[[[string is] true ""]]''' and '''[[[string is] false ""]]''' (i.e., testing the empty string) return 1. This is the case to facilitate entry validation in Tk. ---- [LV] I guess I must be really too old for programming languages, because making a command return a wrong answer to facilitate some other action, in AN EXTENSION, seems just wrong to me. [AM] (18 january 2007) If it is any consolation, in mathematics one needs to deal with similar special cases: * The sum over zero elements * The product over zero elements * Quantifiers over the empty set * In geometry one usually deals with objects "in general position" to avoid thinking about a bunch of collinear points for instance It may seem to be a bizarre hack to make some long forgotten program work, and it probably is. But taking care of these nauseating edge cases is a part of life. [LV] Oh, I understand having to have hacks to make things work. But it seems, to me, that making the uniquely strange behavior the exception, rather than the rule, would have been the way to go. So the person writing a highly specific case of a particular kind of widget has to add a special flag... no big deal. Instead, however, everyone who wants this function to work as expected has to add -strict to their invocations. ---- You can sometimes get into trouble relying on these different forms. For example, in Tk: ====== pack [checkbutton .cb -variable toggle] set toggle 1 ;# Works fine. set toggle true ;# Clears the checkbox! ====== You can work around this using [checkbutton]'s '''-onvalue''' and '''-offvalue''' arguments, but you're still limited to just one recognised value for each state: ====== pack [checkbutton .cb -variable toggle -onvalue true -offvalue false] set toggle true ;# Works fine. set toggle 1 ;# Clears the checkbox! ====== ---- The canonical form for true, like in C, is integer 1. To wit: % expr 42==42 1 [1S] See also: [Boolean], [magic names] <> Glossary | Internals