two box collides, on collition assign deferent value please ?

hi i need help:

I have two boxes with collide, and I need that if the player hits the first box, then assign a value ( var result == 1 ) and if it collides with the second box assign a different value ( var result == 2 )

thanks a lot

This is some pseudo code that might work for you:

if(Collision.gameObject == box1) {
    result = 1;
} else if (Collision.gameObject == box2) {
    result = 2;
}

Of course, you'd have to specify what "box1" and "box2" are in your script.