sjjvenu
V2EX  ›  Swift

请教一个 leetcode 上 Swift 语法展开问题

  •  
  •   sjjvenu · Dec 13, 2017 · 5172 views
    This topic created in 3075 days ago, the information mentioned may be changed or developed.
    /**
     * Definition for singly-linked list.
     * public class ListNode {
     *     public var val: Int
     *     public var next: ListNode?
     *     public init(_ val: Int) {
     *         self.val = val
     *         self.next = nil
     *     }
     * }
     */
    class Solution {
        func reverseList(_ head: ListNode?) -> ListNode? {
            var rev: ListNode? = nil, head = head
            while head != nil
            {
                (head, rev, head!.next) = (head!.next, head, rev)   //请问下这段展开表达式
            }
            return rev
        }
    }
    

    请问下如上标记那段的展开表达式是什么?

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1228 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 17:41 · PVG 01:41 · LAX 10:41 · JFK 13:41
    ♥ Do have faith in what you're doing.