Improve the consistency between code and comments in Kotlin (#1268)

* style(kotlin): Make code and comments consistent.

* style(kotlin): convert comment location.

* style(c): Add missing comment.

* style(kotlin): Remove redundant semicolon, parenthesis and brace

* style(kotlin): Put constants inside the function.

* style(kotlin): fix unnecessary indentation.

* style(swift): Add missing comment.

* style(kotlin): Add missing comment.

* style(kotlin): Remove redundant comment.

* style(kotlin): Add missing comment.

* Update linked_list.kt

* style(csharp,js,ts): Add missing comment.

* style(kotlin): Remove empty lines.

* Update list.cs

* Update list.js

* Update list.ts

* roll back to commit 1

* style(cs,js,ts): Add missing comment in docfile.

* style(kotlin): Use normal element swapping instead of scope functions.
This commit is contained in:
curtishd
2024-04-13 20:09:39 +08:00
committed by GitHub
parent b0d6fa0f38
commit 4d9bbe72e1
25 changed files with 74 additions and 61 deletions
@@ -20,6 +20,7 @@ fun insert(n0: ListNode?, p: ListNode?) {
fun remove(n0: ListNode?) {
if (n0?.next == null)
return
// n0 -> P -> n1
val p = n0.next
val n1 = p?.next
n0.next = n1
@@ -78,10 +79,10 @@ fun main() {
printLinkedList(n0)
/* 访问节点 */
val node: ListNode = access(n0, 3)!!
val node = access(n0, 3)!!
println("链表中索引 3 处的节点的值 = ${node._val}")
/* 查找节点 */
val index: Int = find(n0, 2)
val index = find(n0, 2)
println("链表中值为 2 的节点的索引 = $index")
}