# Declaring variables through an if statement

**URL:** <https://forum.kirupa.com/t/declaring-variables-through-an-if-statement/253169>\
**Category:** Uncategorized\
**Created:** [February 27, 2008, 9:11pm UTC](https://forum.kirupa.com/t/declaring-variables-through-an-if-statement/253169 "2008-02-27T21:11:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![idrissofny](https://avatars.discourse-cdn.com/v4/letter/i/fbc32d/32.png) [@idrissofny](https://forum.kirupa.com/u/idrissofny)\
**Post date:** [February 27, 2008, 9:11pm UTC](https://forum.kirupa.com/t/declaring-variables-through-an-if-statement/253169/1 "2008-02-27T21:11:47Z")

</div>

i’m kind of an actionscript noob 😊  
does this make any sense?

i’m trying to define a variable based on whether or not another variable is null.  
(i created this example for the sake of clarity)

```auto
var nothing:String = null;
var apples:String = "Red";
var bananas:String = "Yellow";
var blueberries:String = "Blue";

if (nothing == null) {
	
	var fruitSalad:String = "colorless";
	
} else {
	
	var fruitSalad:String = apples + bananas + blueberries;
	
}

trace(fruitSalad);

```

i keep getting this as an error:  
1151: A conflict exists with definition fruitSalad in namespace internal.

any help would rock :thumb:

thanks guys | idriss
