Creating ball prefab and assigning it a rigidbody

Hey, so I’m doing an online gamedev course and I’m having some trouble understanding a bit of code. I numbered each line of code and the comments/questions are below with the corresponding number.

if (Input.GetKeyDown(KeyCode.LeftArrow))
         1  GameObject Instance =  Instantiate(ballPrefab); 
         2  Rigidbody rb = Instance.GetComponent<Rigidbody>(); 
         3  rb.velocity = Vector3.left*speed; 
  1. So on this line, Instantiate creates a ball prefab and assigns it to the GameObject Instance, correct?

  2. This takes the ball prefab that was assigned the name Instance and assigns it a rigidbody, or is it just creating a rigidbody to be assigned later on? This line is where I’m most confused.

  3. Takes the rigidbody object and assigns it a velocity.

Instantiate creates a clone of the prefab you provide. The prefab is in the form of a GameObject and the clone is in the form of a GameObject. So on line one you are creating a clone of ballPrefab and assigning it to a local variable called Instance which is a GameObject.

GetComponent attempts to retrieve a specified component(script) from a GameObject. If the component does not currently exist on the GameObject then it will provide a null value. So on line two you are attempting to grab the Rigidbody component and assign it to a local variable called rb which is a Rigidbody.

You are on the right track and I hope this clears some things up.
Here are the Unity API docs for future reference: