# True/False

**URL:** <https://forum.kirupa.com/t/true-false/2794>\
**Category:** flash\
**Created:** [April 5, 2002, 3:34pm UTC](https://forum.kirupa.com/t/true-false/2794 "2002-04-05T15:34:56Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 5, 2002, 3:34pm UTC](https://forum.kirupa.com/t/true-false/2794/1 "2002-04-05T15:34:56Z")

</div>

Just a very simple question:\rWhat does the “something” = true\ror\r"something" = false\rmean?\rAnd what do true and false stand for.\r\rDon Albino

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 5, 2002, 4:00pm UTC](https://forum.kirupa.com/t/true-false/2794/2 "2002-04-05T16:00:25Z")

</div>

true and false are booleans. true and false can be replaced with 1 and 0 (respectively) in a mathematical equasion.\rexample:\rmyVariable = “hello”==“hello”\rtrace(myVariable);\rmyVariable++;\rtrace(myVariable);\rwill return:\rtrue\r2\r\rbooleans can be used in conditionals like switches with only an on or off state.\rlight = true;\rif(light){\rtrace (“the light is on”);\r} else {\rtrace (“the light is off”);\r}\rwill trace:\rthe light is on\rbecause the variable ‘light’ is set to ‘true’.\rhope that helps!\r:) \rjeremy

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 5, 2002, 10:21pm UTC](https://forum.kirupa.com/t/true-false/2794/3 "2002-04-05T22:21:15Z")

</div>

OK\rYou totally lost me, since I don’t have a clue, what “++” means, what the trace is, what a boolean is ( I have English as a second language and nobody could tell me what a boolean is) and the will return part and all that stuff.\rTry to explain it in an easier example. (the second one was better, but still too weird)\r\rThanks for your help anyway.\r(it is the thought that counts)\r\rDon Albino

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 5, 2002, 10:53pm UTC](https://forum.kirupa.com/t/true-false/2794/4 "2002-04-05T22:53:39Z")

</div>

Well, booleans are… true and false. Basically, a boolean has these 2 values only. Well, in terms of numbers, 1 is equivalent to true, and 0 to false.

> example:\rmyVariable = “hello”==“hello”\r// myVariable is the result of the test : Is the string “hello” equal \r// to the string “hello”, which will give true if it’s a boolean and 1\r//if it’s a number\r\rtrace(myVariable);\r//This displays the value of myVariable in the output window\r\rmyVariable++;\r//This increments myVariable by 1. It’s equivalent to \r//myVariable = myVariable + 1. ie 2.\r//2 is not 0 so it will be true. Hence :\r\rtrace(myVariable);\rwill return:\rtrue\r2\r\rbooleans can be used in conditionals like switches with only an on or off state.\rlight = true;\rif(light){ //equivalent to if light==true or light!=0\rtrace (“the light is on” );\r} else {\rtrace (“the light is off” );\r}\rwill trace:\rthe light is on\rbecause the variable ‘light’ is set to ‘true’.  
> I hope it’s clearer now.\r\rpom 0]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 6, 2002, 6:06am UTC](https://forum.kirupa.com/t/true-false/2794/5 "2002-04-06T06:06:47Z")

</div>

actually, in terms of numbers ‘0’ (zero) is false, and any other number is true. however ‘true’ only has a numeric value of ‘1’.\r:) \rjeremy

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 7, 2002, 10:55pm UTC](https://forum.kirupa.com/t/true-false/2794/6 "2002-04-07T22:55:36Z")

</div>

So basically you want to say, that false is “0” and true is the rest.\rBut why would you use true/false then if oyu could just write a number instead of it.\r\rSo if want something to happen when hello == hello, then I would write it like that?:\r\r\rif (“hello” == “hello” == true) {\r trace (“Hello”);\r}\r\r\rI hope that is just kind of close. Though I didn’t completely understand it yet I thank you for the help.\r\rDon Albino

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 7, 2002, 11:07pm UTC](https://forum.kirupa.com/t/true-false/2794/7 "2002-04-07T23:07:24Z")

</div>

Not exactly.\ryOu wrote :\rSo if want something to happen when hello == hello, then I would write it like that?:\r\rif (“hello” == “hello” == true) {\rtrace (“Hello”);\r}\r\rif (“hello” == “hello”) {\rtrace (“hello”) ;\r}\ris correct. The meaning of == is : is this equal ? So “hello”==“hello” will return “true”, or “1”, while “hello”==“sausage” will return “false” or “0”.\rYou have to understand that in if (something) …, the “== true” you put is implied. the “something” has to be true for the if to execute the code. I have the horrible feeling that I’m not clear at all.\r\rpom 0]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2002, 12:54am UTC](https://forum.kirupa.com/t/true-false/2794/8 "2002-04-08T00:54:09Z")

</div>

Well…\r\rI think I got it now.\rBut the trace is not necessary, is it?\rI could as well use a gotoAndPlay, or any other action, right?\rThe thing is, that I already used this in things like:\r\rx = “2”;\r\r(now the button)\r\ron (release) {\r&nbsp &nbsp &nbsp &nbsp if (x == 2) {\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp gotoAndStop (2);\r&nbsp &nbsp &nbsp &nbsp }\r}\r\r\rthat basically is true or false, is it not?\r\rI think I got the true or flase part now, but why would you write “true” or “false” instead of just “0” or “1”?\r\rDon Albino\r\r(i think I am stupid)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2002, 1:18am UTC](https://forum.kirupa.com/t/true-false/2794/9 "2002-04-08T01:18:35Z")

</div>

i write out true and false when the variable is only being used as a boolean. sometimes i will check a variable as if it were a boolean when it’s not a boolean. like if i need to know if a variable has a numeric value or not (strings evaluate to false).\r:) \rjeremy

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2002, 1:46pm UTC](https://forum.kirupa.com/t/true-false/2794/10 "2002-04-08T13:46:00Z")

</div>

And what are strings?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2002, 2:17pm UTC](https://forum.kirupa.com/t/true-false/2794/11 "2002-04-08T14:17:35Z")

</div>

x=2 : number\rx=“2” : string.\rpom 0]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2002, 10:58pm UTC](https://forum.kirupa.com/t/true-false/2794/12 "2002-04-08T22:58:43Z")

</div>

And where is the difference in Flash?\rWhen would you use a string and when number?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2002, 11:41pm UTC](https://forum.kirupa.com/t/true-false/2794/13 "2002-04-08T23:41:53Z")

</div>

paste this into a new blank movie and test it:\r// here’s the difference:\r// a number as a number…\rnTwo = 2;\r// a number as a string…\rsTwo = “2”;\r// adding the numbers together…\rnAdd = nTwo+nTwo;\r// adding the strings together…\rsAdd = sTwo+sTwo;\r// output the variables…\rtrace ("the number = “+nAdd+”  
the string = "+sAdd);\r// the value of ‘nAdd’ is 4, the value of ‘sAdd’ is “22”.\r\rwhen you add the number 2 to the number 2 you get 4.\rwhen you add the string 2 to the string 2 you get 22.\r:) \rjeremy

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 9, 2002, 1:42pm UTC](https://forum.kirupa.com/t/true-false/2794/14 "2002-04-09T13:42:38Z")

</div>

Thanks again. That made it clear.\rFor what would I use a string then?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 9, 2002, 1:47pm UTC](https://forum.kirupa.com/t/true-false/2794/15 "2002-04-09T13:47:27Z")

</div>

I’m not sure if you got the basics:\r\rTrue and False are same as Yes and No:\rTrue = Yes\rFalse = No\r\rNumbers can be used in mathematical scripts.\rStrings are basicly words. These can be used for text-related actions.\r\rnum1 = 2\rnum2 = 4\rword1 = “This is”\rword2 = " a String"\r\rsum = num1 + num2\rsentence = word1 + word2\r\rsum will show: 6\rsentence will show: This is a String
