Skip to content

Commit 119a199

Browse files
committed
Fix garbled code examples for C, Perl (id)
1 parent 6f429c9 commit 119a199

File tree

2 files changed

+13
-2
lines changed
  • id/documentation/ruby-from-other-languages

2 files changed

+13
-2
lines changed

id/documentation/ruby-from-other-languages/to-ruby-from-c-and-c-/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Berikut ini adalah contoh program untuk menjumlahkan dua angka
4242
(diinputkan dari keyboard) di C:
4343

4444
{% highlight python %}
45-
#include
45+
#include <stdio.h>
4646

4747
int main(int argc, char *argv[])
4848
{

id/documentation/ruby-from-other-languages/to-ruby-from-perl/index.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,18 @@ menggunakan bahasa Perl:
2222

2323
{% highlight perl %}
2424
$n = 5;
25-
sub bottle { my $n = shift; $n
25+
sub bottle { my $n = shift; $n < 2 ? "$n bottle" : "$n bottles" }
26+
while ($n) {
27+
print <<"BOTOL";
28+
${\bottle $n} of beer on the wall
29+
${\bottle $n} of beer
30+
Take one down, pass it around
31+
${\bottle --$n} of beer on the wall
32+
33+
BOTOL
34+
}
35+
36+
print "No more beer on the wall :-(\n";
2637
{% endhighlight %}
2738

2839
Program tersebut dapat ditulis sebagai berikut di Ruby: \*

0 commit comments

Comments
 (0)