Some functions return a value. If you don’t understand what that means, I recommend looking it up in some programming tutorials – it’s an essential concept that you’ll need to understand before moving forward.
hit is a reference to a RaycastHit2D object that was returned by the Linecast call.
hit.collider is a reference to the hit’s collider. Normally, it indicates which collider was hit.
By checking if it’s null, the code checks if that value is set. Any reference value can potentially equal null, which means that it’s not pointing at anything. That’s another concept that you’ll need to understand at some point.
Logical operators like != return boolean values, which are either true or false.
So, if you return a value like hit.collider != null, you’re basically answering the question “Does this hit have a collider?”