Can someone explain to me how this if else loop works? : studying some linked lists and not sure how this loop works with the assignment.
 
The question where the code is from is to find the intersection of two linked lists. 


`ListNode *getIntersectionNode(ListNode *headA, ListNode *headB) {
    ListNode *cur1 = headA, *cur2 = headB;
    while(cur1 != cur2){
        cur1 = cur1?cur1->next:headB;
        cur2 = cur2?cur2->next:headA;
    }
    return cur1;
}`

not sure how the cur1 = cur1 is evaluated with assignments rather than a boolean condition. I understand how the iteration works but unsure of why I can't just do 

`while(cur1!=cur2){
      cur1=cur1->next;
      cur2=cur2->next;
}
return cur1;`

with this i'm pretty sure I will end up with a runtime error though.
 