- This wiki is out of date, use the continuation of this wiki instead
TRUE
From FenixWiki
(Difference between revisions)
Revision as of 14:35, 1 May 2007 (edit) FCR (Talk | contribs) ← Previous diff |
Current revision (09:37, 17 July 2007) (edit) (undo) Sandman (Talk | contribs) m (→Definition) |
||
(5 intermediate revisions not shown.) | |||
Line 1: | Line 1: | ||
== Definition == | == Definition == | ||
- | '''INT''' | + | '''INT''' TRUE |
- | True is a [[constant]] | + | True is a [[constant]] [[int]]eger, equal to the value 1. It is used to state that something is true and not [[false]]. |
+ | |||
+ | Checking whether a variable is true, is the same as checking if it's nonzero. In older versions of [[Fenix]], it was the same as checking whether a variable is odd. This has been changed because it's more commonly used. | ||
== Example == | == Example == | ||
<pre> | <pre> | ||
- | + | Program example; | |
- | if ( | + | Private |
- | + | int b = true; | |
- | end | + | Begin |
- | </pre> | + | |
+ | // comparison with the constant TRUE | ||
+ | if(b == true) | ||
+ | say("b was TRUE! so b==1"); | ||
+ | else | ||
+ | say("b was not TRUE! so b!=1"); | ||
+ | end | ||
+ | |||
+ | // checking the integer itself | ||
+ | if(b) | ||
+ | say("b was true! so b!=0"); | ||
+ | else | ||
+ | say("b was false! so b==0"); | ||
+ | end | ||
+ | |||
+ | Loop | ||
+ | frame; | ||
+ | End | ||
+ | |||
+ | End</pre> | ||
[[category:constants]] | [[category:constants]] |
Current revision
[edit] Definition
INT TRUE
True is a constant integer, equal to the value 1. It is used to state that something is true and not false.
Checking whether a variable is true, is the same as checking if it's nonzero. In older versions of Fenix, it was the same as checking whether a variable is odd. This has been changed because it's more commonly used.
[edit] Example
Program example; Private int b = true; Begin // comparison with the constant TRUE if(b == true) say("b was TRUE! so b==1"); else say("b was not TRUE! so b!=1"); end // checking the integer itself if(b) say("b was true! so b!=0"); else say("b was false! so b==0"); end Loop frame; End End