Having trouble iterating through an array of GameObjects of a certain type

I'm working on an inventory system, and I want it to be an array of gameobjects of type Item (a script that I have in my project). I have a gameobject in the scene with script Item.js, that has an itemName var defined, and the collision code to call the AddItem function in the Inventory script on the player with itself as the parameter. Here is the inventory script so far:

var inventory : Item[];
var inventoryLength : int = 16;

function Awake () {
    inventory = new Item[inventoryLength];
}

function OnGUI(){
    for( var i = 0; i < inventory.length; i++ ){
        var currentItem = inventory*;*
 *if(currentItem != null){*
 _GUI.Label (Rect (30, (30*i), 120, 30), currentItem.itemName);_
 *}*
 *}*
*}*
*function AddItem( item : Item )*
*{*
 *for( var i = 0; i < inventory.length; i++ )*
 *{*
 _if( inventory *== null )*_
 _*{*_
 <em>_inventory *= item;*_</em>
 <em><em>_print(inventory*.itemName);*_</em></em>
 <em><em>_*return;*_</em></em>
 <em><em>_*}*_</em></em>
 <em><em>_*}*_</em></em> 
<em><em>_*}*_</em></em>
<em><em>_*```*_</em></em>
<em><em>_*<p>Notice in the AddItem function I am printing the itemName var of the item being added upon collision after I inserted into the inventory.  THAT is working.  However, in my OnGUI function where I am trying to iterate through the inventory and print all the itemNames as labels, it is not doing anything.  No errors, nothing.  What am I doing wrong?</p>*_</em></em>

EDIT: After re-reading the question and comments, I now believe that you were not properly passing the instances of the Item script to your array. Make sure to get them with GetComponent and that they actually have the script attached.

EDIT 2: As it seems the place wherein you are incorrectly passing the items to your inventory is in the collision code that you failed to provide, I will provide how that code and setup looks like for a working setup that I tested:

Item.js (attached to some object(s) in the scene)

var itemName : String;

function OnCollisionEnter(collision : Collision) {
    var script : Inventory = collision.gameObject.GetComponent(Inventory);
    if(script) script.AddItem(gameObject);
    else Debug.LogError(collision.gameObject.name + " has no inventory.");
}

Inventory.js (attached to some other object(s) in the scene)

var size : int = 16;
var items : Item[];

function Start() {
    items = new Item;
}

function OnGUI () {
    for(var i : int = 0; i < items.length; i++) {
        var item : Item = items*;*
 _if(item != null) GUI.Label(Rect(30, 30 * i, 120,30), item.itemName);_
 *}*
*}*
*function AddItem(obj : GameObject) {*
 *if(obj == null) {*
 *Debug.LogError("Tried to add an invalid Item");*
 *return;*
 *}*
 *var item : Item = obj.GetComponent(Item);*
 *if(item == null) {*
 *Debug.LogError("Tried to add an invalid Item");*
 *return;*
 *}*
 *for(var i : int = 0; i < items.length; i++) {*
 _if(items *== null) {*_
 <em>_items *= item;*_</em>
 <em>_*Debug.Log("Added " + item.itemName);*_</em>
 <em>_*return;*_</em>
 <em>_*}*_</em>
 <em>_*}*_</em>
 <em>_*Debug.LogWarning("Inventory full.");*_</em>
<em>_*}*_</em>
<em>_*```*_</em>