X-Git-Url: http://git.harvie.cz/?a=blobdiff_plain;f=demos%2Fboolean.c;h=77d1967d16ba7bbc9d6f943c7ca119526a27dfa0;hb=b79112e5436c4b443c70ba3d62e4c35391224d63;hp=838e31c44789501a0058e74167b13f1913c72e57;hpb=099b0ca0180a985138b03ed81290e7268e051756;p=svn%2FCll1h%2F.git diff --git a/demos/boolean.c b/demos/boolean.c index 838e31c..77d1967 100644 --- a/demos/boolean.c +++ b/demos/boolean.c @@ -2,10 +2,21 @@ program { - boolean t=TRUE,f=FALSE; + const bool t = TRUE, f = FALSE; + bool l, m = MAYBE; + str s; + + print("TRUE and FALSE =", btoa(t and f) ); + print("TRUE or FALSE =", btoa(t or f) ); + print("TRUE and MAYBE =", btoa(t and m) ); + print("FALSE or MAYBE =", btoa(t or m) ); + print("not FALSE =", btoa(not f) ); + print("not TRUE =", btoa(not t) ); + print("not MAYBE =", btoa(not m) ); - printf("TRUE and FALSE = %s", bool_str(t and f) ); - printf(",TRUE or FALSE = %s", bool_str(t or f) ); - printf(",not FALSE = %s", bool_str(not f) ); - printf(",not TRUE = %s\n", bool_str(not t) ); + for_strs(s, "TRUE","false","yes","NO","True","FALSE","YES","no","Yes","No","1","0","abc","xyz","Eyes","Ears","rue","alse","oui","no","ano","ne"," ","NULL",NULL,EOL,"","ano","ne") + { + l = atob(s); + echo("\"", s, "\"\tmeans ", btoa(l), EOL); + } }