Skip to content

Commit 3d27211

Browse files
committed
Fix garbled code examples in news post (id)
1 parent 9cab0ba commit 3d27211

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

id/news/_posts/2008-05-28-21-trik-trik-ruby.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ bisa langsung mendefinisikan variabel lokal “sekaligus” ketika operasi
135135
sedang berlangsung:
136136

137137
{% highlight ruby %}
138-
(z ||= [])
138+
(z ||= []) << 'coba'
139139
{% endhighlight %}
140140

141141
**8 – Penggunaan yang-bukan-string maupun yang-bukan-simbol sebagai hash
@@ -165,7 +165,13 @@ yang pendek-pendek:
165165
{% highlight ruby %}
166166
queue = []
167167
%w{hello x world}.each do |word|
168-
queue
168+
queue << word and puts "Added to queue" unless word.length < 2
169+
end
170+
puts queue.inspect
171+
# Output:
172+
# Added to queue
173+
# Added to queue
174+
# ["hello", "world"]
169175
{% endhighlight %}
170176

171177
**10 – Menentukan eksekusi kode**

0 commit comments

Comments
 (0)