Çoklu Satır Yorumları Ruby? | Netgez.com
SORU
7 HAZÄ°RAN 2010, PAZARTESÄ°


Çoklu Satır Yorumları Ruby?

Nasıl Ruby birden fazla satır yorum alabilir miyim?

CEVAP
7 HAZÄ°RAN 2010, PAZARTESÄ°


#!/usr/bin/env ruby

=begin
Every body mentioned this way
to have multiline comments.

It has to be at the beginning of a line or
it will be a syntax error.
=end

puts "Hello world!"

<<-DOC
Also, you could create a docstring.
which...
DOC

puts "Hello world!"

"..is kinda ugly and creates
a String instance, but I know one guy
with a Smalltalk background, who
does this."

puts "Hello world!"

##
# most
# people
# do
# this


__END__

But all forgot there is another option.
Only at the end of a file, of course.

Bunu PaylaÅŸ:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VÄ°DEO

Rastgele Yazarlar

  • Electro Posé

    Electro PosÃ

    21 ÅžUBAT 2013
  • ravinderosahn

    ravinderosah

    20 Temmuz 2009
  • TechBalance

    TechBalance

    12 HAZÄ°RAN 2011