mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-24 20:16:06 +00:00
Fix inconsistent comments Ruby - chapter array and linked list (#1202)
* fix: inconsistent comments Ruby - chapter array and linked list * fix: better Ruby code & comments
This commit is contained in:
@@ -178,8 +178,8 @@
|
||||
attr_accessor :val # 节点值
|
||||
attr_accessor :next # 指向下一节点的引用
|
||||
|
||||
def initialize(val=nil, next_node=nil)
|
||||
@val = val || 0
|
||||
def initialize(val=0, next_node=nil)
|
||||
@val = val
|
||||
@next = next_node
|
||||
end
|
||||
end
|
||||
@@ -709,8 +709,8 @@
|
||||
attr_accessor :next # 指向后继节点的引用
|
||||
attr_accessor :prev # 指向前驱节点的引用
|
||||
|
||||
def initialize(val=nil, next_node=nil, prev_node=nil)
|
||||
@val = val || 0
|
||||
def initialize(val=0, next_node=nil, prev_node=nil)
|
||||
@val = val
|
||||
@next = next_node
|
||||
@prev = prev_node
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user