How to transfer colllider from OnTriggerEnter to Update

using UnityEngine;
using System.Collections;

public class testtrigger : MonoBehaviour {

	Collider lastCollider;
	void OnTriggerEnter(Collider other){
		lastCollider = other;
		Debug.Log (lastCollider);
	}
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		Debug.Log (lastCollider);
	}
}

Line 9 returns a collider butt line 18 returns null. Why?

you can try this, it will make sure that lastcollider is not returned from update() unless it has a value.

 using UnityEngine;
 using System.Collections;
 
 public class testtrigger : MonoBehaviour {
 
     Collider lastCollider;

     void OnTriggerEnter(Collider other){
         lastCollider = other;
         Debug.Log (lastCollider);
     }
     // Use this for initialization
     void Start () {
     
     }
     
     // Update is called once per frame
     void Update () {
        if(lastCollider != null)
        {
         Debug.Log (lastCollider);
        }
     }
 }