First commit of partial RosettaCode contents.
Pushing this for testing purposes. Lots of work still needed.
This commit is contained in:
commit
1e05ecd7ee
781 changed files with 9080 additions and 0 deletions
4
Task/Comments/0DESCRIPTION
Normal file
4
Task/Comments/0DESCRIPTION
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
Demonstrate all ways to include text in a language source file which is completely ignored by the compiler or interpreter.
|
||||
|
||||
'''See Also:'''<br>
|
||||
* [http://xkcd.com/156 xkcd] (Humor: hand gesture denoting <code>//</code> for "commenting out" people).
|
||||
2
Task/Comments/1META.yaml
Normal file
2
Task/Comments/1META.yaml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
note: Basic language learning
|
||||
1
Task/Comments/4D/comments.4d
Normal file
1
Task/Comments/4D/comments.4d
Normal file
|
|
@ -0,0 +1 @@
|
|||
`Comments in 4th Dimension begin with the accent character and extend to the end of the line.
|
||||
3
Task/Comments/AWK/comments.awk
Normal file
3
Task/Comments/AWK/comments.awk
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
BEGIN { # this code does something
|
||||
# do something
|
||||
}
|
||||
6
Task/Comments/Befunge/comments-2.bf
Normal file
6
Task/Comments/Befunge/comments-2.bf
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
&;read a number;2+;add two;.@;display result and exit;
|
||||
^- inline comments -^ <-^- other comments
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;completely isolated comment block for the paranoid;
|
||||
;(almost - you can still skip into it.) ;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
2
Task/Comments/Befunge/comments.bf
Normal file
2
Task/Comments/Befunge/comments.bf
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
& read a number 2+ add two .@ display result and exit
|
||||
^- inline comments -^ <-^- other comments
|
||||
2
Task/Comments/C/comments-2.c
Normal file
2
Task/Comments/C/comments-2.c
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
struct charisma {};
|
||||
void f(char/* comment */isma) {}
|
||||
1
Task/Comments/C/comments-3.c
Normal file
1
Task/Comments/C/comments-3.c
Normal file
|
|
@ -0,0 +1 @@
|
|||
/* some comment /* trying to nest some other comment */ inside */
|
||||
3
Task/Comments/C/comments-4.c
Normal file
3
Task/Comments/C/comments-4.c
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#if 0
|
||||
While technically not a comment, this is also ignored by the compiler
|
||||
#endif
|
||||
7
Task/Comments/C/comments-5.c
Normal file
7
Task/Comments/C/comments-5.c
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#ifdef UNDEFINED
|
||||
This is not compiled.
|
||||
#if 0
|
||||
Nor is this.
|
||||
#endif
|
||||
And this still is not compiled.
|
||||
#endif
|
||||
3
Task/Comments/C/comments-6.c
Normal file
3
Task/Comments/C/comments-6.c
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#if 0
|
||||
This isn't valid.
|
||||
#endif
|
||||
1
Task/Comments/C/comments-7.c
Normal file
1
Task/Comments/C/comments-7.c
Normal file
|
|
@ -0,0 +1 @@
|
|||
// C++ single-line comments were adopted in the C99 standard.
|
||||
4
Task/Comments/C/comments.c
Normal file
4
Task/Comments/C/comments.c
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
/* This is a comment. */
|
||||
/* So is this
|
||||
multiline comment.
|
||||
*/
|
||||
1
Task/Comments/Clojure/comments-2.clj
Normal file
1
Task/Comments/Clojure/comments-2.clj
Normal file
|
|
@ -0,0 +1 @@
|
|||
(comment (println (foo)) "bar" :baz 123 (System/exit 0)) ;; does nothing, returns nil
|
||||
2
Task/Comments/Clojure/comments-3.clj
Normal file
2
Task/Comments/Clojure/comments-3.clj
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
(+ 1 (comment "foo") 3) ;; Throws an exception, because it tries to add nil to an integer
|
||||
(+ 1 #_"foo" 3) ;; Returns 4
|
||||
3
Task/Comments/Clojure/comments.clj
Normal file
3
Task/Comments/Clojure/comments.clj
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
;; This is a comment
|
||||
(defn foo []
|
||||
123) ; also a comment
|
||||
5
Task/Comments/CoffeeScript/comments.coffee
Normal file
5
Task/Comments/CoffeeScript/comments.coffee
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# one line comment
|
||||
|
||||
### multi
|
||||
line
|
||||
comment ###
|
||||
1
Task/Comments/Erlang/comments.erl
Normal file
1
Task/Comments/Erlang/comments.erl
Normal file
|
|
@ -0,0 +1 @@
|
|||
% Erlang comments begin with "%" and extend to the end of the line.
|
||||
1
Task/Comments/Forth/comments-2.fth
Normal file
1
Task/Comments/Forth/comments-2.fth
Normal file
|
|
@ -0,0 +1 @@
|
|||
: myword ( a b -- c ) ...
|
||||
2
Task/Comments/Forth/comments-3.fth
Normal file
2
Task/Comments/Forth/comments-3.fth
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
: add'em ( a b -- a+b ) + ;
|
||||
: strlen ( addr -- len ) count nip ;
|
||||
11
Task/Comments/Forth/comments-4.fth
Normal file
11
Task/Comments/Forth/comments-4.fth
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
\s skips all remaining text in the file
|
||||
(( skips until the next double-paren,
|
||||
stretching across multiple lines ))
|
||||
comment:
|
||||
Ignore all text in this section
|
||||
comment;
|
||||
doc
|
||||
Another comment block
|
||||
enddoc
|
||||
/* C-style comment */
|
||||
(* Pascal-style comment *)
|
||||
2
Task/Comments/Forth/comments.fth
Normal file
2
Task/Comments/Forth/comments.fth
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
\ The backslash skips everything else on the line
|
||||
( The left paren skips everything up to the next right paren on the same line)
|
||||
2
Task/Comments/Fortran/comments-2.f
Normal file
2
Task/Comments/Fortran/comments-2.f
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
C If compiled in debugging mode, print the current value of I
|
||||
D PRINT *, I
|
||||
1
Task/Comments/Fortran/comments-3.f
Normal file
1
Task/Comments/Fortran/comments-3.f
Normal file
|
|
@ -0,0 +1 @@
|
|||
real :: a = 0.0 ! initialize A to be zero
|
||||
7
Task/Comments/Fortran/comments-4.f
Normal file
7
Task/Comments/Fortran/comments-4.f
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
?? if (.false.) then
|
||||
do while (oh_no)
|
||||
a = bad_news()
|
||||
b = big_mistake()
|
||||
c = gigo()
|
||||
end do
|
||||
?? end if
|
||||
2
Task/Comments/Fortran/comments.f
Normal file
2
Task/Comments/Fortran/comments.f
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
C This would be some kind of comment
|
||||
C Usually one would avoid columns 2-6 even in a comment.
|
||||
5
Task/Comments/Go/comments.go
Normal file
5
Task/Comments/Go/comments.go
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
// this is a single line comment
|
||||
/* this is
|
||||
a multi-line
|
||||
block comment.
|
||||
/* It does not nest */
|
||||
15
Task/Comments/Haskell/comments.hs
Normal file
15
Task/Comments/Haskell/comments.hs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
i code = True -- I am a comment.
|
||||
|
||||
{- I am also
|
||||
a comment. {-comments can be nested-}
|
||||
let u x = x x (this code not compiled)
|
||||
Are you? -}
|
||||
|
||||
-- |This is a Haddock documentation comment for the following code
|
||||
i code = True
|
||||
-- ^This is a Haddock documentation comment for the preceding code
|
||||
|
||||
{-|
|
||||
This is a Haddock documentation block comment
|
||||
-}
|
||||
i code = True
|
||||
5
Task/Comments/Java/comments-2.java
Normal file
5
Task/Comments/Java/comments-2.java
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/*
|
||||
* This is
|
||||
* a multiple
|
||||
* line comment.
|
||||
*/
|
||||
1
Task/Comments/Java/comments-3.java
Normal file
1
Task/Comments/Java/comments-3.java
Normal file
|
|
@ -0,0 +1 @@
|
|||
// This is a comment
|
||||
1
Task/Comments/Java/comments-4.java
Normal file
1
Task/Comments/Java/comments-4.java
Normal file
|
|
@ -0,0 +1 @@
|
|||
/** This is a Javadoc comment */
|
||||
5
Task/Comments/Java/comments-5.java
Normal file
5
Task/Comments/Java/comments-5.java
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/**
|
||||
* This is
|
||||
* a multiple
|
||||
* line Javadoc comment
|
||||
*/
|
||||
1
Task/Comments/Java/comments.java
Normal file
1
Task/Comments/Java/comments.java
Normal file
|
|
@ -0,0 +1 @@
|
|||
/* This is a comment */
|
||||
7
Task/Comments/LaTeX/comments-2.tex
Normal file
7
Task/Comments/LaTeX/comments-2.tex
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
\newcommand{\firstpart}{understand}
|
||||
\newcommand{\secondpart}{able}
|
||||
\newcommand{\complete}{%
|
||||
\firstpart%
|
||||
\secondpart}
|
||||
|
||||
\complete
|
||||
1
Task/Comments/LaTeX/comments.tex
Normal file
1
Task/Comments/LaTeX/comments.tex
Normal file
|
|
@ -0,0 +1 @@
|
|||
% This is a comment
|
||||
2
Task/Comments/Lua/comments-2.lua
Normal file
2
Task/Comments/Lua/comments-2.lua
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
--[====[ A multi-line comment that can contain [[ many square brackets ]]
|
||||
]====]
|
||||
4
Task/Comments/Lua/comments.lua
Normal file
4
Task/Comments/Lua/comments.lua
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
-- A single line comment
|
||||
|
||||
--[[A multi-line
|
||||
comment --]]
|
||||
2
Task/Comments/PHP/comments-2.php
Normal file
2
Task/Comments/PHP/comments-2.php
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
$var = 1; # this is the comment part
|
||||
$var = 1; // this is the comment part
|
||||
4
Task/Comments/PHP/comments-3.php
Normal file
4
Task/Comments/PHP/comments-3.php
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
/*
|
||||
Here are my comments
|
||||
this is multi-line
|
||||
*/
|
||||
4
Task/Comments/PHP/comments-4.php
Normal file
4
Task/Comments/PHP/comments-4.php
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
/**
|
||||
* phpdoc Comments
|
||||
* @todo this is a todo stub
|
||||
*/
|
||||
2
Task/Comments/PHP/comments.php
Normal file
2
Task/Comments/PHP/comments.php
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# this is commented
|
||||
// this is commented
|
||||
1
Task/Comments/Perl/comments-2.pl
Normal file
1
Task/Comments/Perl/comments-2.pl
Normal file
|
|
@ -0,0 +1 @@
|
|||
my $var = 1; # this is the comment part
|
||||
6
Task/Comments/Perl/comments-3.pl
Normal file
6
Task/Comments/Perl/comments-3.pl
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
=pod
|
||||
|
||||
Here are my comments
|
||||
this is multi-line
|
||||
|
||||
=cut
|
||||
4
Task/Comments/Perl/comments-4.pl
Normal file
4
Task/Comments/Perl/comments-4.pl
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
=head1
|
||||
=head4
|
||||
=over 4
|
||||
=Any Old String
|
||||
1
Task/Comments/Perl/comments.pl
Normal file
1
Task/Comments/Perl/comments.pl
Normal file
|
|
@ -0,0 +1 @@
|
|||
# this is commented
|
||||
12
Task/Comments/PicoLisp/comments.l
Normal file
12
Task/Comments/PicoLisp/comments.l
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# The rest of the line is ignored
|
||||
#{
|
||||
This is a
|
||||
multiline comment
|
||||
}#
|
||||
NIL
|
||||
Immediately stop reading this file. Because all text in the input file following
|
||||
a top-level 'NIL' is ignored.
|
||||
|
||||
This is typically used conditionally, with a read-macro expression like
|
||||
`*Dbg
|
||||
so that this text is only read if in debugging mode.
|
||||
17
Task/Comments/Python/comments-2.py
Normal file
17
Task/Comments/Python/comments-2.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env python
|
||||
# Example of using doc strings
|
||||
"""My Doc-string example"""
|
||||
|
||||
class Foo:
|
||||
'''Some documentation for the Foo class'''
|
||||
def __init__(self):
|
||||
"Foo's initialization method's documentation"
|
||||
|
||||
def bar():
|
||||
"""documentation for the bar function"""
|
||||
|
||||
if __name__ == "__main__":
|
||||
print (__doc__)
|
||||
print (Foo.__doc__)
|
||||
print (Foo.__init__.__doc__)
|
||||
print (bar.__doc__)
|
||||
9
Task/Comments/Python/comments.py
Normal file
9
Task/Comments/Python/comments.py
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
"""Un-assigned strings in triple-quotes might be used
|
||||
as multi-line comments
|
||||
"""
|
||||
|
||||
'''
|
||||
"triple quoted strings" can be delimited by either 'single' or "double" quote marks; and they can contain mixtures
|
||||
of other quote marks without any need to \escape\ them using any special characters. They also may span multiple
|
||||
lines without special escape characters.
|
||||
'''
|
||||
3
Task/Comments/REXX/comments-2.rexx
Normal file
3
Task/Comments/REXX/comments-2.rexx
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
-- A REXX line comment
|
||||
|
||||
say "something" -- another line comment
|
||||
42
Task/Comments/REXX/comments.rexx
Normal file
42
Task/Comments/REXX/comments.rexx
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/*REXX program to demonstrate various uses and types of comments. */
|
||||
|
||||
/* everything between a "climbstar" and a "starclimb" (exclusive of literals) is
|
||||
a comment.
|
||||
climbstar = /* [slash-asterisk]
|
||||
starclimb = */ [asterisk-slash]
|
||||
|
||||
/* this is a nested comment, by gum! */
|
||||
/*so is this*/
|
||||
|
||||
Also, REXX comments can span multiple records.
|
||||
|
||||
There can be no intervening character between the slash and asterisk (or
|
||||
the asterisk and slash). These two joined characters cannot be separated
|
||||
via a continued line, as in the manner of:
|
||||
|
||||
say 'If I were twoâfaced,' ,
|
||||
'would I be wearing this one?' ,
|
||||
' --- Abraham Lincoln'
|
||||
|
||||
Here come's the thingy that ends this REXX comment. ââââ
|
||||
â
|
||||
â
|
||||
â
|
||||
|
||||
*/
|
||||
|
||||
hour = 12 /*high noon */
|
||||
midnight = 00 /*first hour of the day */
|
||||
suits = 1234 /*card suits: ⥠⦠⣠â */
|
||||
|
||||
hutchHdr = '/*'
|
||||
hutchEnd = "*/"
|
||||
|
||||
/* the previous two "hutch" assignments aren't
|
||||
the start nor the end of a REXX comment. */
|
||||
|
||||
x=1000000 ** /*¡big power!*/ 1000
|
||||
|
||||
/*not a real good place for a comment (above),
|
||||
but essentially, a REXX comment can be
|
||||
anywhere whitespace is allowed. */
|
||||
5
Task/Comments/Ruby/comments.rb
Normal file
5
Task/Comments/Ruby/comments.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
x = "code" # I am a comment
|
||||
|
||||
=begin hello
|
||||
I a POD documentation comment like Perl
|
||||
=end puts "code"
|
||||
4
Task/Comments/Scala/comments.scala
Normal file
4
Task/Comments/Scala/comments.scala
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
// A single line comment
|
||||
|
||||
/* A multi-line
|
||||
comment */
|
||||
4
Task/Comments/Tcl/comments-2.tcl
Normal file
4
Task/Comments/Tcl/comments-2.tcl
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
set aList {foo}
|
||||
lappend aList # bar
|
||||
puts $aList ;# ==> prints "foo # bar"
|
||||
puts [llength $aList] ;# ==> 3
|
||||
3
Task/Comments/Tcl/comments-3.tcl
Normal file
3
Task/Comments/Tcl/comments-3.tcl
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
if 0 {
|
||||
Comments...
|
||||
}
|
||||
3
Task/Comments/Tcl/comments.tcl
Normal file
3
Task/Comments/Tcl/comments.tcl
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# comment on a line by itself. The next is a command by itself:
|
||||
set var1 $value1
|
||||
set var2 $value2 ; # comment that follows a line of code
|
||||
Loading…
Add table
Add a link
Reference in a new issue