task_url stringlengths 30 116 | task_name stringlengths 2 86 | task_description stringlengths 0 14.4k | language_url stringlengths 2 53 | language_name stringlengths 1 52 | code stringlengths 0 61.9k |
|---|---|---|---|---|---|
http://rosettacode.org/wiki/Conditional_structures | Conditional structures | Control Structures
These are examples of control structures. You may also be interested in:
Conditional structures
Exceptions
Flow-control structures
Loops
Task
List the conditional structures offered by a programming language. See Wikipedia: conditionals for descriptions.
Common conditional structures include ... | #Go | Go | if booleanExpression {
statements
} |
http://rosettacode.org/wiki/Comma_quibbling | Comma quibbling | Comma quibbling is a task originally set by Eric Lippert in his blog.
Task
Write a function to generate a string output which is the concatenation of input words from a list/sequence where:
An input of no words produces the output string of just the two brace characters "{}".
An input of just one word, e.g. ["AB... | #PureBasic | PureBasic |
EnableExplicit
Procedure.s CommaQuibble(Input$)
Protected i, count
Protected result$, word$
Input$ = RemoveString(Input$, "[")
Input$ = RemoveString(Input$, "]")
Input$ = RemoveString(Input$, #DQUOTE$)
count = CountString(Input$, ",") + 1
result$ = "{"
For i = 1 To count
word$ = StringField(Inpu... |
http://rosettacode.org/wiki/Command-line_arguments | Command-line arguments | Command-line arguments is part of Short Circuit's Console Program Basics selection.
Scripted main
See also Program name.
For parsing command line arguments intelligently, see Parsing command-line arguments.
Example command line:
myprogram -c "alpha beta" -h "gamma"
| #Ursa | Ursa | #
# command-line arguments
#
# output all arguments
for (decl int i) (< i (size args)) (inc i)
out args<i> endl console
end for |
http://rosettacode.org/wiki/Command-line_arguments | Command-line arguments | Command-line arguments is part of Short Circuit's Console Program Basics selection.
Scripted main
See also Program name.
For parsing command line arguments intelligently, see Parsing command-line arguments.
Example command line:
myprogram -c "alpha beta" -h "gamma"
| #Ursala | Ursala | #import std
#executable ('parameterized','')
clarg = <.file$[contents: --<''>+ _option%LP]>+ ~command.options |
http://rosettacode.org/wiki/Command-line_arguments | Command-line arguments | Command-line arguments is part of Short Circuit's Console Program Basics selection.
Scripted main
See also Program name.
For parsing command line arguments intelligently, see Parsing command-line arguments.
Example command line:
myprogram -c "alpha beta" -h "gamma"
| #V | V | $stack puts
./args.v a b c
=[args.v a b c] |
http://rosettacode.org/wiki/Command-line_arguments | Command-line arguments | Command-line arguments is part of Short Circuit's Console Program Basics selection.
Scripted main
See also Program name.
For parsing command line arguments intelligently, see Parsing command-line arguments.
Example command line:
myprogram -c "alpha beta" -h "gamma"
| #vbScript | vbScript |
'Command line arguments can be accessed all together by
For Each arg In Wscript.Arguments
Wscript.Echo "arg=", arg
Next
'You can access only the named arguments such as /arg:value
For Each arg In Wscript.Arguments.Named
Wscript.Echo "name=", arg, "value=", Wscript.Arguments.Named(arg)
Next
'Or just th... |
http://rosettacode.org/wiki/Comments | Comments | Task
Show all ways to include text in a language source file
that's completely ignored by the compiler or interpreter.
Related tasks
Documentation
Here_document
See also
Wikipedia
xkcd (Humor: hand gesture denoting // for "commenting out" people.)
| #HTML | HTML | <!-- Anything within these bracket tags is commented, single or multi-line. --> |
http://rosettacode.org/wiki/Comments | Comments | Task
Show all ways to include text in a language source file
that's completely ignored by the compiler or interpreter.
Related tasks
Documentation
Here_document
See also
Wikipedia
xkcd (Humor: hand gesture denoting // for "commenting out" people.)
| #Icon_and_Unicon | Icon and Unicon | # This is a comment
procedure x(y,z) #: This is a comment and an IPL meta-comment for a procedure
|
http://rosettacode.org/wiki/Conway%27s_Game_of_Life | Conway's Game of Life | The Game of Life is a cellular automaton devised by the British mathematician John Horton Conway in 1970. It is the best-known example of a cellular automaton.
Conway's game of life is described here:
A cell C is represented by a 1 when alive, or 0 when dead, in an m-by-m (or m×m) sq... | #Phix | Phix | --
-- demo\rosetta\Conways_Game_of_Life.exw
-- =====================================
--
with javascript_semantics
include pGUI.e
constant title = "Conway's Game of Life"
Ihandle dlg, canvas
Ihandln hTimer = NULL
cdCanvas cddbuffer
sequence c = {}, -- cells
cn, -- new cells
cl -- la... |
http://rosettacode.org/wiki/Conditional_structures | Conditional structures | Control Structures
These are examples of control structures. You may also be interested in:
Conditional structures
Exceptions
Flow-control structures
Loops
Task
List the conditional structures offered by a programming language. See Wikipedia: conditionals for descriptions.
Common conditional structures include ... | #Harbour | Harbour | IF x == 1
SomeFunc1()
ELSEIF x == 2
SomeFunc2()
ELSE
SomeFunc()
ENDIF |
http://rosettacode.org/wiki/Comma_quibbling | Comma quibbling | Comma quibbling is a task originally set by Eric Lippert in his blog.
Task
Write a function to generate a string output which is the concatenation of input words from a list/sequence where:
An input of no words produces the output string of just the two brace characters "{}".
An input of just one word, e.g. ["AB... | #Python | Python | >>> def strcat(sequence):
return '{%s}' % ', '.join(sequence)[::-1].replace(',', 'dna ', 1)[::-1]
>>> for seq in ([], ["ABC"], ["ABC", "DEF"], ["ABC", "DEF", "G", "H"]):
print('Input: %-24r -> Output: %r' % (seq, strcat(seq)))
Input: [] -> Output: '{}'
Input: ['ABC'] ... |
http://rosettacode.org/wiki/Command-line_arguments | Command-line arguments | Command-line arguments is part of Short Circuit's Console Program Basics selection.
Scripted main
See also Program name.
For parsing command line arguments intelligently, see Parsing command-line arguments.
Example command line:
myprogram -c "alpha beta" -h "gamma"
| #Visual_Basic | Visual Basic | Sub Main
MsgBox Command$
End Sub |
http://rosettacode.org/wiki/Command-line_arguments | Command-line arguments | Command-line arguments is part of Short Circuit's Console Program Basics selection.
Scripted main
See also Program name.
For parsing command line arguments intelligently, see Parsing command-line arguments.
Example command line:
myprogram -c "alpha beta" -h "gamma"
| #Visual_Basic_.NET | Visual Basic .NET | Sub Main(ByVal args As String())
For Each token In args
Console.WriteLine(token)
Next
End Sub |
http://rosettacode.org/wiki/Command-line_arguments | Command-line arguments | Command-line arguments is part of Short Circuit's Console Program Basics selection.
Scripted main
See also Program name.
For parsing command line arguments intelligently, see Parsing command-line arguments.
Example command line:
myprogram -c "alpha beta" -h "gamma"
| #Vlang | Vlang | import os
fn main() {
for i, x in os.args[1..] {
println("the argument #$i is $x")
}
} |
http://rosettacode.org/wiki/Comments | Comments | Task
Show all ways to include text in a language source file
that's completely ignored by the compiler or interpreter.
Related tasks
Documentation
Here_document
See also
Wikipedia
xkcd (Humor: hand gesture denoting // for "commenting out" people.)
| #IDL | IDL | ; The following computes the factorial of a number "n"
fact = product(indgen( n )+1) ; where n should be an integer |
http://rosettacode.org/wiki/Comments | Comments | Task
Show all ways to include text in a language source file
that's completely ignored by the compiler or interpreter.
Related tasks
Documentation
Here_document
See also
Wikipedia
xkcd (Humor: hand gesture denoting // for "commenting out" people.)
| #Inform_7 | Inform 7 | [This is a single-line comment.]
[This is a
multi-line comment.]
[Comments can [be nested].] |
http://rosettacode.org/wiki/Conway%27s_Game_of_Life | Conway's Game of Life | The Game of Life is a cellular automaton devised by the British mathematician John Horton Conway in 1970. It is the best-known example of a cellular automaton.
Conway's game of life is described here:
A cell C is represented by a 1 when alive, or 0 when dead, in an m-by-m (or m×m) sq... | #Picat | Picat | go =>
Rows = 3,
Cols = 3,
println(blinker),
pattern(blinker, Pattern,I,J),
life(fill(Rows,Cols,Pattern,I,J)),
nl.
fill(Rows, Cols, Obj) = fill(Rows, Cols, Obj,1,1).
fill(Rows, Cols, Obj,OffsetI,OffsetJ) = Grid =>
Grid = new_array(Rows,Cols), bind_vars(Grid,0),
foreach(I in 1..Obj.length, J in... |
http://rosettacode.org/wiki/Conditional_structures | Conditional structures | Control Structures
These are examples of control structures. You may also be interested in:
Conditional structures
Exceptions
Flow-control structures
Loops
Task
List the conditional structures offered by a programming language. See Wikipedia: conditionals for descriptions.
Common conditional structures include ... | #Haskell | Haskell | fac x = if x==0 then
1
else x * fac (x - 1) |
http://rosettacode.org/wiki/Comma_quibbling | Comma quibbling | Comma quibbling is a task originally set by Eric Lippert in his blog.
Task
Write a function to generate a string output which is the concatenation of input words from a list/sequence where:
An input of no words produces the output string of just the two brace characters "{}".
An input of just one word, e.g. ["AB... | #Quackery | Quackery | [ swap join join ] is glue ( [ [ [ --> [ )
[ [ dup size
dup 0 = iff
[ 2drop [] ] done
dup 1 = iff
[ drop unpack ] done
2 = iff
[ unpack $ ' and ' glue ] done
behead swap recurse $ ', ' glue ]
$ '{' swap join $ '}' join ] is quibble ( [ --> $ )
[... |
http://rosettacode.org/wiki/Comma_quibbling | Comma quibbling | Comma quibbling is a task originally set by Eric Lippert in his blog.
Task
Write a function to generate a string output which is the concatenation of input words from a list/sequence where:
An input of no words produces the output string of just the two brace characters "{}".
An input of just one word, e.g. ["AB... | #R | R | quib <- function(vect)
{
#The task does not consider empty strings to be words, so we remove them immediately.
#We could also remove non-upper-case characters, but the tasks gives off the impression that the user will do that.
vect <- vect[nchar(vect) != 0]
len <- length(vect)
allButLastWord <- if(len >= 2) p... |
http://rosettacode.org/wiki/Command-line_arguments | Command-line arguments | Command-line arguments is part of Short Circuit's Console Program Basics selection.
Scripted main
See also Program name.
For parsing command line arguments intelligently, see Parsing command-line arguments.
Example command line:
myprogram -c "alpha beta" -h "gamma"
| #Wren | Wren | import "os" for Process
System.print(Process.arguments) |
http://rosettacode.org/wiki/Command-line_arguments | Command-line arguments | Command-line arguments is part of Short Circuit's Console Program Basics selection.
Scripted main
See also Program name.
For parsing command line arguments intelligently, see Parsing command-line arguments.
Example command line:
myprogram -c "alpha beta" -h "gamma"
| #XPL0 | XPL0 | int C;
[loop [C:= ChIn(8);
if C = \EOF\$1A then quit;
ChOut(0, C);
];
CrLf(0);
] |
http://rosettacode.org/wiki/Command-line_arguments | Command-line arguments | Command-line arguments is part of Short Circuit's Console Program Basics selection.
Scripted main
See also Program name.
For parsing command line arguments intelligently, see Parsing command-line arguments.
Example command line:
myprogram -c "alpha beta" -h "gamma"
| #zkl | zkl | System.argv.println();
vm.arglist.println(); |
http://rosettacode.org/wiki/Comments | Comments | Task
Show all ways to include text in a language source file
that's completely ignored by the compiler or interpreter.
Related tasks
Documentation
Here_document
See also
Wikipedia
xkcd (Humor: hand gesture denoting // for "commenting out" people.)
| #Intercal | Intercal | PLEASE NOTE This is a comment |
http://rosettacode.org/wiki/Comments | Comments | Task
Show all ways to include text in a language source file
that's completely ignored by the compiler or interpreter.
Related tasks
Documentation
Here_document
See also
Wikipedia
xkcd (Humor: hand gesture denoting // for "commenting out" people.)
| #Io | Io | # Single-line comment
// Single-line comment
/* Multi-line
comment */ |
http://rosettacode.org/wiki/Conway%27s_Game_of_Life | Conway's Game of Life | The Game of Life is a cellular automaton devised by the British mathematician John Horton Conway in 1970. It is the best-known example of a cellular automaton.
Conway's game of life is described here:
A cell C is represented by a 1 when alive, or 0 when dead, in an m-by-m (or m×m) sq... | #PicoLisp | PicoLisp | (load "@lib/simul.l")
(de life (DX DY . Init)
(let Grid (grid DX DY)
(for This Init
(=: life T) )
(loop
(disp Grid NIL
'((This) (if (: life) "X " " ")) )
(wait 1000)
(for Col Grid
(for This Col
(let N # Count neighbors
... |
http://rosettacode.org/wiki/Conditional_structures | Conditional structures | Control Structures
These are examples of control structures. You may also be interested in:
Conditional structures
Exceptions
Flow-control structures
Loops
Task
List the conditional structures offered by a programming language. See Wikipedia: conditionals for descriptions.
Common conditional structures include ... | #HicEst | HicEst | IF( a > 5 ) WRITE(Messagebox) a ! single line IF
IF( a >= b ) THEN
WRITE(Text=some_string) a, b
ELSEIF(some_string > "?") THEN
WRITE(ClipBoard) some_string
ELSEIF( nonzero ) THEN
WRITE(WINdowhandle=nnn) some_string
ELSE
WRITE(StatusBar) a, b, some_string
ENDIF |
http://rosettacode.org/wiki/Comma_quibbling | Comma quibbling | Comma quibbling is a task originally set by Eric Lippert in his blog.
Task
Write a function to generate a string output which is the concatenation of input words from a list/sequence where:
An input of no words produces the output string of just the two brace characters "{}".
An input of just one word, e.g. ["AB... | #Racket | Racket | (define (quibbling words)
(define (sub-quibbling words)
(match words
['() ""]
[(list a) a]
[(list a b) (format "~a and ~a" a b)]
[(list a b ___) (format "~a, ~a" a (sub-quibbling b))]))
(format "{~a}" (sub-quibbling words)))
(for ((input '([] ["ABC"] ["ABC" "DEF"] ["ABC" "DEF" "G" "H"]... |
http://rosettacode.org/wiki/Comma_quibbling | Comma quibbling | Comma quibbling is a task originally set by Eric Lippert in his blog.
Task
Write a function to generate a string output which is the concatenation of input words from a list/sequence where:
An input of no words produces the output string of just the two brace characters "{}".
An input of just one word, e.g. ["AB... | #Raku | Raku | sub comma-quibbling(@A) {
<{ }>.join: @A < 2 ?? @A !! "@A[0..*-2].join(', ') and @A[*-1]";
}
say comma-quibbling($_) for
[], [<ABC>], [<ABC DEF>], [<ABC DEF G H>]; |
http://rosettacode.org/wiki/Comments | Comments | Task
Show all ways to include text in a language source file
that's completely ignored by the compiler or interpreter.
Related tasks
Documentation
Here_document
See also
Wikipedia
xkcd (Humor: hand gesture denoting // for "commenting out" people.)
| #Isabelle | Isabelle | theory Text
imports Main
begin
(* Top-level Isar comment. *)
end |
http://rosettacode.org/wiki/Comments | Comments | Task
Show all ways to include text in a language source file
that's completely ignored by the compiler or interpreter.
Related tasks
Documentation
Here_document
See also
Wikipedia
xkcd (Humor: hand gesture denoting // for "commenting out" people.)
| #J | J | NB. Text that follows 'NB.' has no effect on execution.
0 : 0
Multi-line comments may be placed in strings,
like this.
)
Note 'example'
Another way to record multi-line comments as text is to use 'Note', which is actually
a simple program that makes it clearer when defined text is used only to provide comment.
)
... |
http://rosettacode.org/wiki/Conway%27s_Game_of_Life | Conway's Game of Life | The Game of Life is a cellular automaton devised by the British mathematician John Horton Conway in 1970. It is the best-known example of a cellular automaton.
Conway's game of life is described here:
A cell C is represented by a 1 when alive, or 0 when dead, in an m-by-m (or m×m) sq... | #PL.2FI | PL/I | (subscriptrange):
Conway: procedure options (main); /* 20 November 2013 */
/* A grid of (1:100, 1:100) is desired; the array GRID is defined as (0:101, 0:101), */
/* to satisfy the requirement that elements off-grid are zero. */
declare n fixed binary; /* grid size) */
put ('W... |
http://rosettacode.org/wiki/Conditional_structures | Conditional structures | Control Structures
These are examples of control structures. You may also be interested in:
Conditional structures
Exceptions
Flow-control structures
Loops
Task
List the conditional structures offered by a programming language. See Wikipedia: conditionals for descriptions.
Common conditional structures include ... | #HPPPL | HPPPL | IF X THEN
// do if X is not 0
ELSE
// do if X is 0
END; |
http://rosettacode.org/wiki/Comma_quibbling | Comma quibbling | Comma quibbling is a task originally set by Eric Lippert in his blog.
Task
Write a function to generate a string output which is the concatenation of input words from a list/sequence where:
An input of no words produces the output string of just the two brace characters "{}".
An input of just one word, e.g. ["AB... | #REBOL | REBOL | rebol []
comma-quibbling: func [block] [
rejoin [
"^{"
to-string use [s] [
s: copy block
s: next s
forskip s 2 [insert s either tail? next s [" and "] [", "]]
s: head s
]
"^}"
]
]
foreach t [[] [ABC] [ABC DEF] [ABC DEF G H]]... |
http://rosettacode.org/wiki/Comma_quibbling | Comma quibbling | Comma quibbling is a task originally set by Eric Lippert in his blog.
Task
Write a function to generate a string output which is the concatenation of input words from a list/sequence where:
An input of no words produces the output string of just the two brace characters "{}".
An input of just one word, e.g. ["AB... | #REXX | REXX | say quibbling('')
say quibbling('ABC')
say quibbling('ABC DEF')
say quibbling('ABC DEF G H')
exit
quibbling: procedure
parse arg list
Select
When list='' Then result=''
When words(list)=1 then result=word(list,1)
Otherwise result=translate(strip(subword(list,1,words(list)-1)),',',' '),
... |
http://rosettacode.org/wiki/Comments | Comments | Task
Show all ways to include text in a language source file
that's completely ignored by the compiler or interpreter.
Related tasks
Documentation
Here_document
See also
Wikipedia
xkcd (Humor: hand gesture denoting // for "commenting out" people.)
| #Java | Java | /* This is a comment */ |
http://rosettacode.org/wiki/Comments | Comments | Task
Show all ways to include text in a language source file
that's completely ignored by the compiler or interpreter.
Related tasks
Documentation
Here_document
See also
Wikipedia
xkcd (Humor: hand gesture denoting // for "commenting out" people.)
| #JavaScript | JavaScript | n = n + 1; // This is a comment |
http://rosettacode.org/wiki/Conway%27s_Game_of_Life | Conway's Game of Life | The Game of Life is a cellular automaton devised by the British mathematician John Horton Conway in 1970. It is the best-known example of a cellular automaton.
Conway's game of life is described here:
A cell C is represented by a 1 when alive, or 0 when dead, in an m-by-m (or m×m) sq... | #Pointless | Pointless | -----------------------------------------------------------
-- Print 100 simulated states of conway's game of life
-- for a glider starting pattern on a wrapping grid
-- Print generation number along with cells
output =
initCells
|> iterate(updateCells)
|> take(130)
|> enumerate
|> map(showPair)
|> printF... |
http://rosettacode.org/wiki/Conditional_structures | Conditional structures | Control Structures
These are examples of control structures. You may also be interested in:
Conditional structures
Exceptions
Flow-control structures
Loops
Task
List the conditional structures offered by a programming language. See Wikipedia: conditionals for descriptions.
Common conditional structures include ... | #i | i | //'i' supports if, else, and else if
software {
a = 3
if a = 3
print("a = three")
else if a = 2
print("a = two")
else
print("a = ", a)
end
} |
http://rosettacode.org/wiki/Comma_quibbling | Comma quibbling | Comma quibbling is a task originally set by Eric Lippert in his blog.
Task
Write a function to generate a string output which is the concatenation of input words from a list/sequence where:
An input of no words produces the output string of just the two brace characters "{}".
An input of just one word, e.g. ["AB... | #Ring | Ring |
# Project : Comma Quibbling
text = list(4)
text[1] = "{}"
text[2] = "ABC"
text[3] = "ABC,DEF"
text[4] = "ABC,DEF,G,H"
comma(text)
func comma(text)
listtext = []
for n = 1 to 4
listtext = str2list(substr(text[n], ",", nl))
if n = 2
see "{" + list2str(listtext) +... |
http://rosettacode.org/wiki/Comma_quibbling | Comma quibbling | Comma quibbling is a task originally set by Eric Lippert in his blog.
Task
Write a function to generate a string output which is the concatenation of input words from a list/sequence where:
An input of no words produces the output string of just the two brace characters "{}".
An input of just one word, e.g. ["AB... | #Ruby | Ruby | def comma_quibbling(a)
%w<{ }>.join(a.length < 2 ? a.first :
"#{a[0..-2].join(', ')} and #{a[-1]}")
end
[[], %w<ABC>, %w<ABC DEF>, %w<ABC DEF G H>].each do |a|
puts comma_quibbling(a)
end |
http://rosettacode.org/wiki/Comments | Comments | Task
Show all ways to include text in a language source file
that's completely ignored by the compiler or interpreter.
Related tasks
Documentation
Here_document
See also
Wikipedia
xkcd (Humor: hand gesture denoting // for "commenting out" people.)
| #JCL | JCL |
//* This is a comment line (//* in columns 1-3)
|
http://rosettacode.org/wiki/Comments | Comments | Task
Show all ways to include text in a language source file
that's completely ignored by the compiler or interpreter.
Related tasks
Documentation
Here_document
See also
Wikipedia
xkcd (Humor: hand gesture denoting // for "commenting out" people.)
| #Joy | Joy | # this is a single line comment
(* this is a
multi-line comment *) |
http://rosettacode.org/wiki/Conway%27s_Game_of_Life | Conway's Game of Life | The Game of Life is a cellular automaton devised by the British mathematician John Horton Conway in 1970. It is the best-known example of a cellular automaton.
Conway's game of life is described here:
A cell C is represented by a 1 when alive, or 0 when dead, in an m-by-m (or m×m) sq... | #PostScript | PostScript | %!PS-Adobe-3.0
%%BoundingBox: 0 0 400 400
/size 400 def
realtime srand
/rand1 { rand 2147483647 div } def
/m { moveto } bind def
/l { rlineto} bind def
/drawboard {
0 1 n 1 sub { /y exch def
0 1 n 1 sub { /x exch def
board x get y get 1 eq {
x c mul y c mul ... |
http://rosettacode.org/wiki/Conditional_structures | Conditional structures | Control Structures
These are examples of control structures. You may also be interested in:
Conditional structures
Exceptions
Flow-control structures
Loops
Task
List the conditional structures offered by a programming language. See Wikipedia: conditionals for descriptions.
Common conditional structures include ... | #Icon_and_Unicon | Icon and Unicon | if expr0 then
expr1
else
expr2 |
http://rosettacode.org/wiki/Comma_quibbling | Comma quibbling | Comma quibbling is a task originally set by Eric Lippert in his blog.
Task
Write a function to generate a string output which is the concatenation of input words from a list/sequence where:
An input of no words produces the output string of just the two brace characters "{}".
An input of just one word, e.g. ["AB... | #Run_BASIC | Run BASIC | wrds$ = "[]
[""ABC""]
[""ABC"", ""DEF""]
[""ABC"", ""DEF"", ""G"", ""H""]
"
while word$(wrds$,j+1,chr$(13)) <> ""
a$ = word$(wrds$,j+1,chr$(13))
print a$;" ==> ";
a$ = "{"+mid$(a$,2,len(a$)-2)+"}"
j = j + 1
for i = len(a$) to 1 step -1
if mid$(a$,i,1) = "," then
a$ = left$(a$,i-1) + " and " + mi... |
http://rosettacode.org/wiki/Comma_quibbling | Comma quibbling | Comma quibbling is a task originally set by Eric Lippert in his blog.
Task
Write a function to generate a string output which is the concatenation of input words from a list/sequence where:
An input of no words produces the output string of just the two brace characters "{}".
An input of just one word, e.g. ["AB... | #Rust | Rust |
fn quibble(seq: &[&str]) -> String {
match seq.len() {
0 => "{}".to_string(),
1 => format!("{{{}}}", seq[0]),
_ => {
format!("{{{} and {}}}",
seq[..seq.len() - 1].join(", "),
seq.last().unwrap())
}
}
}
fn main() {
printl... |
http://rosettacode.org/wiki/Comments | Comments | Task
Show all ways to include text in a language source file
that's completely ignored by the compiler or interpreter.
Related tasks
Documentation
Here_document
See also
Wikipedia
xkcd (Humor: hand gesture denoting // for "commenting out" people.)
| #jq | jq | # this is a single line comment
"Hello #world" # the first # on this line is part of the jq program
|
http://rosettacode.org/wiki/Comments | Comments | Task
Show all ways to include text in a language source file
that's completely ignored by the compiler or interpreter.
Related tasks
Documentation
Here_document
See also
Wikipedia
xkcd (Humor: hand gesture denoting // for "commenting out" people.)
| #Jsish | Jsish | #!/usr/bin/env/jsish
/* Comments, in Jsish */
// to end of line comment, double slash
/*
Enclosed comment, slash star, ending with star slash
Cannot be nested, but can cross line boundaries and occur
pretty much anywhere whitespace is allowed
*/
var x = 'X'; /* A var called X */
/* active code on this line */ ... |
http://rosettacode.org/wiki/Conway%27s_Game_of_Life | Conway's Game of Life | The Game of Life is a cellular automaton devised by the British mathematician John Horton Conway in 1970. It is the best-known example of a cellular automaton.
Conway's game of life is described here:
A cell C is represented by a 1 when alive, or 0 when dead, in an m-by-m (or m×m) sq... | #Prolog | Prolog |
%----------------------------------------------------------------------%
% GAME OF LIFE %
% %
% Adapt the prediacte grid_size according to the grid size of the %
% start pic. ... |
http://rosettacode.org/wiki/Conditional_structures | Conditional structures | Control Structures
These are examples of control structures. You may also be interested in:
Conditional structures
Exceptions
Flow-control structures
Loops
Task
List the conditional structures offered by a programming language. See Wikipedia: conditionals for descriptions.
Common conditional structures include ... | #IDL | IDL | if a eq 5 then print, "a equals five" [else print, "a is something else"] |
http://rosettacode.org/wiki/Comma_quibbling | Comma quibbling | Comma quibbling is a task originally set by Eric Lippert in his blog.
Task
Write a function to generate a string output which is the concatenation of input words from a list/sequence where:
An input of no words produces the output string of just the two brace characters "{}".
An input of just one word, e.g. ["AB... | #Scala | Scala | def quibble( s:List[String] ) = s match {
case m if m.isEmpty => "{}"
case m if m.length < 3 => m.mkString("{", " and ", "}")
case m => "{" + m.init.mkString(", ") + " and " + m.last + "}"
}
// A little test...
{
println( quibble( List() ) )
println( quibble( List("ABC") ) )
println( quibble( List("ABC","... |
http://rosettacode.org/wiki/Comma_quibbling | Comma quibbling | Comma quibbling is a task originally set by Eric Lippert in his blog.
Task
Write a function to generate a string output which is the concatenation of input words from a list/sequence where:
An input of no words produces the output string of just the two brace characters "{}".
An input of just one word, e.g. ["AB... | #Scheme | Scheme |
(define (quibble . args)
(display "{")
(do ((rem args (cdr rem)))
((null? rem) (display "}\n"))
(display (car rem))
(cond ((= 1 (length rem)) )
((= 2 (length rem))
(display " and "))
(else
(display ", ")))))
(quibble)
(quibble "ABC")
(quibble "ABC" "DEF")
(... |
http://rosettacode.org/wiki/Comments | Comments | Task
Show all ways to include text in a language source file
that's completely ignored by the compiler or interpreter.
Related tasks
Documentation
Here_document
See also
Wikipedia
xkcd (Humor: hand gesture denoting // for "commenting out" people.)
| #Julia | Julia | # single line
#=
Multi-
line
comment
=# |
http://rosettacode.org/wiki/Comments | Comments | Task
Show all ways to include text in a language source file
that's completely ignored by the compiler or interpreter.
Related tasks
Documentation
Here_document
See also
Wikipedia
xkcd (Humor: hand gesture denoting // for "commenting out" people.)
| #K | K | / this is a comment
2+2 / as is this
|
http://rosettacode.org/wiki/Conway%27s_Game_of_Life | Conway's Game of Life | The Game of Life is a cellular automaton devised by the British mathematician John Horton Conway in 1970. It is the best-known example of a cellular automaton.
Conway's game of life is described here:
A cell C is represented by a 1 when alive, or 0 when dead, in an m-by-m (or m×m) sq... | #Processing | Processing | boolean play = true;
int cellSize = 10;
int cols, rows;
int lastCell = 0;
int sample = 10;
// Game of life board
int[][] grid;
void setup() {
size(800, 500);
noStroke();
// Calculate cols, rows and init array
cols = width/cellSize;
rows = height/cellSize;
grid = new int[cols][rows];
init(-1); // randomi... |
http://rosettacode.org/wiki/Conditional_structures | Conditional structures | Control Structures
These are examples of control structures. You may also be interested in:
Conditional structures
Exceptions
Flow-control structures
Loops
Task
List the conditional structures offered by a programming language. See Wikipedia: conditionals for descriptions.
Common conditional structures include ... | #Inform_7 | Inform 7 | [short form]
if N is 1, say "one.";
otherwise say "not one.";
[block form]
if N is 1:
say "one.";
otherwise if N is 2:
say "two.";
otherwise:
say "not one or two.";
[short and long forms can be negated with "unless"]
unless N is 1, say "not one." |
http://rosettacode.org/wiki/Comma_quibbling | Comma quibbling | Comma quibbling is a task originally set by Eric Lippert in his blog.
Task
Write a function to generate a string output which is the concatenation of input words from a list/sequence where:
An input of no words produces the output string of just the two brace characters "{}".
An input of just one word, e.g. ["AB... | #Sed | Sed | s/#.*$//g
y/[/{/
y/]/}/
s/"//g
s/ [A-Z][A-Z]*}/ and&/g
s/, and/ and/ |
http://rosettacode.org/wiki/Comma_quibbling | Comma quibbling | Comma quibbling is a task originally set by Eric Lippert in his blog.
Task
Write a function to generate a string output which is the concatenation of input words from a list/sequence where:
An input of no words produces the output string of just the two brace characters "{}".
An input of just one word, e.g. ["AB... | #Seed7 | Seed7 | $ include "seed7_05.s7i";
const func string: quibble (in array string: input) is func
result
var string: quibble is "{";
begin
case length(input) of
when {0}: quibble &:= "}";
when {1}: quibble &:= input[1] & "}";
otherwise: quibble &:= join(input[.. pred(length(input))], ", ") &
... |
http://rosettacode.org/wiki/Comments | Comments | Task
Show all ways to include text in a language source file
that's completely ignored by the compiler or interpreter.
Related tasks
Documentation
Here_document
See also
Wikipedia
xkcd (Humor: hand gesture denoting // for "commenting out" people.)
| #KonsolScript | KonsolScript | //This is a comment.
//This is another comment.
/* This is a comment too. */
/* This is a
multi-line
comment */ |
http://rosettacode.org/wiki/Comments | Comments | Task
Show all ways to include text in a language source file
that's completely ignored by the compiler or interpreter.
Related tasks
Documentation
Here_document
See also
Wikipedia
xkcd (Humor: hand gesture denoting // for "commenting out" people.)
| #Kotlin | Kotlin | // This is a single line comment
/*
This is a
multi-line
comment
*/
/*
Multi-line comments
/*
can also be nested
*/
like so
*/
const val CURRENT_VERSION = "1.0.5-2" // A comment can also be added at the end of a line
const val /* or even in the middle of a line */ NEXT_MAJOR_... |
http://rosettacode.org/wiki/Conway%27s_Game_of_Life | Conway's Game of Life | The Game of Life is a cellular automaton devised by the British mathematician John Horton Conway in 1970. It is the best-known example of a cellular automaton.
Conway's game of life is described here:
A cell C is represented by a 1 when alive, or 0 when dead, in an m-by-m (or m×m) sq... | #Python | Python | import random
from collections import defaultdict
printdead, printlive = '-#'
maxgenerations = 3
cellcount = 3,3
celltable = defaultdict(int, {
(1, 2): 1,
(1, 3): 1,
(0, 3): 1,
} ) # Only need to populate with the keys leading to life
##
## Start States
##
# blinker
u = universe = defaultdict(int)
u[(1,0)], u[(... |
http://rosettacode.org/wiki/Conditional_structures | Conditional structures | Control Structures
These are examples of control structures. You may also be interested in:
Conditional structures
Exceptions
Flow-control structures
Loops
Task
List the conditional structures offered by a programming language. See Wikipedia: conditionals for descriptions.
Common conditional structures include ... | #Isabelle | Isabelle | theory Scratch
imports Main
begin
text‹if-then-else›
lemma "(if True then 42 else 0) = 42" by simp
text‹case statement with pattern matching, which evaluates to the True-case›
lemma "case [42] of
Nil ⇒ False
| [x] ⇒ True
| x#xs ⇒ False" by simp
text‹Loops are implemented via recursive f... |
http://rosettacode.org/wiki/Comma_quibbling | Comma quibbling | Comma quibbling is a task originally set by Eric Lippert in his blog.
Task
Write a function to generate a string output which is the concatenation of input words from a list/sequence where:
An input of no words produces the output string of just the two brace characters "{}".
An input of just one word, e.g. ["AB... | #SenseTalk | SenseTalk | Quibble [] // (No input words).
Quibble ["ABC"]
Quibble ["ABC", "DEF"]
Quibble ["ABC", "DEF", "G", "H"]
to Quibble with wordList
if the number of items in wordList is ...
... 0 then put "{}"
... 1 then put "{" & item 1 of wordList & "}"
... else put "{" & (items first to penultimate of wordList) joined by ", "... |
http://rosettacode.org/wiki/Comma_quibbling | Comma quibbling | Comma quibbling is a task originally set by Eric Lippert in his blog.
Task
Write a function to generate a string output which is the concatenation of input words from a list/sequence where:
An input of no words produces the output string of just the two brace characters "{}".
An input of just one word, e.g. ["AB... | #Sidef | Sidef | func comma_quibbling(words) {
'{' + ([words.ft(0, -2).join(', ')]-[''] + [words.last] -> join(' and ')) + '}';
}
[<>, <ABC>, <ABC DEF>, <ABC DEF G H>].each { |w|
say comma_quibbling(w);
} |
http://rosettacode.org/wiki/Comments | Comments | Task
Show all ways to include text in a language source file
that's completely ignored by the compiler or interpreter.
Related tasks
Documentation
Here_document
See also
Wikipedia
xkcd (Humor: hand gesture denoting // for "commenting out" people.)
| #Lambdatalk | Lambdatalk |
;; this is a comment on a single line
°°°
this is
a comment
on several lines
°°°
|
http://rosettacode.org/wiki/Comments | Comments | Task
Show all ways to include text in a language source file
that's completely ignored by the compiler or interpreter.
Related tasks
Documentation
Here_document
See also
Wikipedia
xkcd (Humor: hand gesture denoting // for "commenting out" people.)
| #LabVIEW | LabVIEW | # This is a comment. |
http://rosettacode.org/wiki/Conway%27s_Game_of_Life | Conway's Game of Life | The Game of Life is a cellular automaton devised by the British mathematician John Horton Conway in 1970. It is the best-known example of a cellular automaton.
Conway's game of life is described here:
A cell C is represented by a 1 when alive, or 0 when dead, in an m-by-m (or m×m) sq... | #R | R | # Generates a new board - either a random one, sample blinker or gliders, or user specified.
gen.board <- function(type="random", nrow=3, ncol=3, seeds=NULL)
{
if(type=="random")
{
return(matrix(runif(nrow*ncol) > 0.5, nrow=nrow, ncol=ncol))
} else if(type=="blinker")
{
seeds <- list(c(2,1... |
http://rosettacode.org/wiki/Conditional_structures | Conditional structures | Control Structures
These are examples of control structures. You may also be interested in:
Conditional structures
Exceptions
Flow-control structures
Loops
Task
List the conditional structures offered by a programming language. See Wikipedia: conditionals for descriptions.
Common conditional structures include ... | #J | J | if(s.equals("Hello World"))
{
foo();
}
else if(s.equals("Bye World"))
bar();//{}'s optional for one-liners
else
{
deusEx();
} |
http://rosettacode.org/wiki/Comma_quibbling | Comma quibbling | Comma quibbling is a task originally set by Eric Lippert in his blog.
Task
Write a function to generate a string output which is the concatenation of input words from a list/sequence where:
An input of no words produces the output string of just the two brace characters "{}".
An input of just one word, e.g. ["AB... | #Standard_ML | Standard ML | local
fun quib [] = ""
| quib [x] = x
| quib [x0,x1] = x0 ^ " and " ^ x1
| quib (x::xs) = x ^ ", " ^ quib xs
in
fun quibble xs = "{" ^ quib xs ^ "}"
end
(* Tests: *)
val t_quibble_0 = quibble [] = "{}"
val t_quibble_1 = quibble ["ABC"] = "{ABC}"
val t_quibble_2 = quibble ["ABC", "DEF"] = "{AB... |
http://rosettacode.org/wiki/Comma_quibbling | Comma quibbling | Comma quibbling is a task originally set by Eric Lippert in his blog.
Task
Write a function to generate a string output which is the concatenation of input words from a list/sequence where:
An input of no words produces the output string of just the two brace characters "{}".
An input of just one word, e.g. ["AB... | #Swift | Swift | let inputs = [[], ["ABC"], ["ABC", "DEF"], ["ABC", "DEF", "G", "H"]]
func quibbling(var words:[String]) {
if words.count == 0 {
println("{}")
} else if words.count == 1 {
println("{\(words[0])}")
} else if words.count == 2 {
println("{\(words[0]) and \(words[1])}")
} else {
... |
http://rosettacode.org/wiki/Comments | Comments | Task
Show all ways to include text in a language source file
that's completely ignored by the compiler or interpreter.
Related tasks
Documentation
Here_document
See also
Wikipedia
xkcd (Humor: hand gesture denoting // for "commenting out" people.)
| #Lang5 | Lang5 | # This is a comment. |
http://rosettacode.org/wiki/Comments | Comments | Task
Show all ways to include text in a language source file
that's completely ignored by the compiler or interpreter.
Related tasks
Documentation
Here_document
See also
Wikipedia
xkcd (Humor: hand gesture denoting // for "commenting out" people.)
| #langur | langur | # single line comment starts with hash mark
/* inline or multi-line comment uses C-style syntax */
|
http://rosettacode.org/wiki/Conway%27s_Game_of_Life | Conway's Game of Life | The Game of Life is a cellular automaton devised by the British mathematician John Horton Conway in 1970. It is the best-known example of a cellular automaton.
Conway's game of life is described here:
A cell C is represented by a 1 when alive, or 0 when dead, in an m-by-m (or m×m) sq... | #Racket | Racket |
#lang racket
(require 2htdp/image 2htdp/universe)
;;;
;;; Grid object
;;;
(define (make-empty-grid m n)
(build-vector m (lambda (y) (make-vector n 0))))
(define rows vector-length)
(define (cols grid)
(vector-length (vector-ref grid 0)))
(define (make-grid m n living-cells)
(let loop ([grid (make-empt... |
http://rosettacode.org/wiki/Conditional_structures | Conditional structures | Control Structures
These are examples of control structures. You may also be interested in:
Conditional structures
Exceptions
Flow-control structures
Loops
Task
List the conditional structures offered by a programming language. See Wikipedia: conditionals for descriptions.
Common conditional structures include ... | #Java | Java | if(s.equals("Hello World"))
{
foo();
}
else if(s.equals("Bye World"))
bar();//{}'s optional for one-liners
else
{
deusEx();
} |
http://rosettacode.org/wiki/Comma_quibbling | Comma quibbling | Comma quibbling is a task originally set by Eric Lippert in his blog.
Task
Write a function to generate a string output which is the concatenation of input words from a list/sequence where:
An input of no words produces the output string of just the two brace characters "{}".
An input of just one word, e.g. ["AB... | #Tcl | Tcl | proc commaQuibble {lst} {
return \{[join [lreplace $lst end-1 end [join [lrange $lst end-1 end] " and "]] ", "]\}
}
foreach input { {} {"ABC"} {"ABC" "DEF"} {"ABC" "DEF" "G" "H"} } {
puts [commaQuibble $input]
} |
http://rosettacode.org/wiki/Comma_quibbling | Comma quibbling | Comma quibbling is a task originally set by Eric Lippert in his blog.
Task
Write a function to generate a string output which is the concatenation of input words from a list/sequence where:
An input of no words produces the output string of just the two brace characters "{}".
An input of just one word, e.g. ["AB... | #TXR | TXR | (defun quib (list)
(tree-bind (: last . lead) (reverse list)
`{@{(nreverse lead) ", "}@(if lead " and ")@last}`)) |
http://rosettacode.org/wiki/Comments | Comments | Task
Show all ways to include text in a language source file
that's completely ignored by the compiler or interpreter.
Related tasks
Documentation
Here_document
See also
Wikipedia
xkcd (Humor: hand gesture denoting // for "commenting out" people.)
| #Lasso | Lasso | //This is a comment.
/* This is also a comment. */
/* A multi-line
comment */
/* ==========================
A multi-line
comment
=========================== */ |
http://rosettacode.org/wiki/Comments | Comments | Task
Show all ways to include text in a language source file
that's completely ignored by the compiler or interpreter.
Related tasks
Documentation
Here_document
See also
Wikipedia
xkcd (Humor: hand gesture denoting // for "commenting out" people.)
| #LaTeX | LaTeX | \documentclass{minimal}
\begin{document}
% This is a comment
\end{document} |
http://rosettacode.org/wiki/Conway%27s_Game_of_Life | Conway's Game of Life | The Game of Life is a cellular automaton devised by the British mathematician John Horton Conway in 1970. It is the best-known example of a cellular automaton.
Conway's game of life is described here:
A cell C is represented by a 1 when alive, or 0 when dead, in an m-by-m (or m×m) sq... | #Raku | Raku | class Automaton {
subset World of Str where {
.lines>>.chars.unique == 1 and m/^^<[.#\n]>+$$/
}
has Int ($.width, $.height);
has @.a;
multi method new (World $s) {
self.new:
:width(.pick.chars), :height(.elems),
:a( .map: { [ .comb ] } )
give... |
http://rosettacode.org/wiki/Conditional_structures | Conditional structures | Control Structures
These are examples of control structures. You may also be interested in:
Conditional structures
Exceptions
Flow-control structures
Loops
Task
List the conditional structures offered by a programming language. See Wikipedia: conditionals for descriptions.
Common conditional structures include ... | #JavaScript | JavaScript | if( s == "Hello World" ) {
foo();
} else if( s == "Bye World" ) {
bar();
} else {
deusEx();
} |
http://rosettacode.org/wiki/Comma_quibbling | Comma quibbling | Comma quibbling is a task originally set by Eric Lippert in his blog.
Task
Write a function to generate a string output which is the concatenation of input words from a list/sequence where:
An input of no words produces the output string of just the two brace characters "{}".
An input of just one word, e.g. ["AB... | #UNIX_Shell | UNIX Shell | quibble() {
# Here awk(1) is easier than sed(1).
awk 'BEGIN {
for (i = 1; i < ARGC - 2; i++) s = s ARGV[i] ", "
i = ARGC - 2; if (i > 0) s = s ARGV[i] " and "
i = ARGC - 1; if (i > 0) s = s ARGV[i]
printf "{%s}\n", s
exit 0
}' "$@"
}
quibble
quibble ABC
quibble ABC DEF
quibble ABC DEF G H |
http://rosettacode.org/wiki/Comma_quibbling | Comma quibbling | Comma quibbling is a task originally set by Eric Lippert in his blog.
Task
Write a function to generate a string output which is the concatenation of input words from a list/sequence where:
An input of no words produces the output string of just the two brace characters "{}".
An input of just one word, e.g. ["AB... | #VBA | VBA | Option Explicit
Sub Main()
Debug.Print Quibbling("")
Debug.Print Quibbling("ABC")
Debug.Print Quibbling("ABC, DEF")
Debug.Print Quibbling("ABC, DEF, G, H")
Debug.Print Quibbling("ABC, DEF, G, H, IJKLM, NO, PQRSTUV")
End Sub
Private Function Quibbling(MyString As String) As String
Dim s As String, n A... |
http://rosettacode.org/wiki/Comments | Comments | Task
Show all ways to include text in a language source file
that's completely ignored by the compiler or interpreter.
Related tasks
Documentation
Here_document
See also
Wikipedia
xkcd (Humor: hand gesture denoting // for "commenting out" people.)
| #Liberty_BASIC | Liberty BASIC | 'This is a comment
REM This is a comment
print "This has a comment on the end of the line." 'This is a comment
print "This also has a comment on the end of the line." : REM This is a comment |
http://rosettacode.org/wiki/Comments | Comments | Task
Show all ways to include text in a language source file
that's completely ignored by the compiler or interpreter.
Related tasks
Documentation
Here_document
See also
Wikipedia
xkcd (Humor: hand gesture denoting // for "commenting out" people.)
| #Lily | Lily | # This is a single-line comment |
http://rosettacode.org/wiki/Conway%27s_Game_of_Life | Conway's Game of Life | The Game of Life is a cellular automaton devised by the British mathematician John Horton Conway in 1970. It is the best-known example of a cellular automaton.
Conway's game of life is described here:
A cell C is represented by a 1 when alive, or 0 when dead, in an m-by-m (or m×m) sq... | #Red | Red | Red [
Purpose: "Conway's Game of Life"
Author: "Joe Smith"
]
neigh: [[0 1] [0 -1] [1 0] [-1 0] [1 1] [1 -1] [-1 1] [-1 -1]]
conway: function [petri] [
new-petri: copy/deep petri
repeat row length? petri [
repeat col length? petri [
live-neigh: 0
foreach cell neigh [
try [
if petri/(:row +... |
http://rosettacode.org/wiki/Conditional_structures | Conditional structures | Control Structures
These are examples of control structures. You may also be interested in:
Conditional structures
Exceptions
Flow-control structures
Loops
Task
List the conditional structures offered by a programming language. See Wikipedia: conditionals for descriptions.
Common conditional structures include ... | #JCL | JCL | 0 : ok
4 : warning
8 : error
12 : severe error
16 : terminal error
|
http://rosettacode.org/wiki/Comma_quibbling | Comma quibbling | Comma quibbling is a task originally set by Eric Lippert in his blog.
Task
Write a function to generate a string output which is the concatenation of input words from a list/sequence where:
An input of no words produces the output string of just the two brace characters "{}".
An input of just one word, e.g. ["AB... | #VBScript | VBScript | Function Quibble(s)
arr = Split(s,",")
If s = "" Then
Quibble = "{}"
ElseIf UBound(arr) = 0 Then
Quibble = "{" & arr(0) & "}"
Else
Quibble = "{"
For i = 0 To UBound(arr)
If i = UBound(arr) - 1 Then
Quibble = Quibble & arr(i) & " and " & arr(i + 1) & "}"
Exit For
Else
Quibble = Quibble & a... |
http://rosettacode.org/wiki/Comma_quibbling | Comma quibbling | Comma quibbling is a task originally set by Eric Lippert in his blog.
Task
Write a function to generate a string output which is the concatenation of input words from a list/sequence where:
An input of no words produces the output string of just the two brace characters "{}".
An input of just one word, e.g. ["AB... | #Visual_Basic_.NET | Visual Basic .NET | Option Explicit On
Option Infer On
Option Strict On
Module Program
Function FormatEnumerable(source As IEnumerable(Of String)) As String
Dim res As New Text.StringBuilder("{")
Using en = source.GetEnumerator()
Dim moreThanOne As Boolean = False
Dim nxt = If(en.MoveNext(),... |
http://rosettacode.org/wiki/Comments | Comments | Task
Show all ways to include text in a language source file
that's completely ignored by the compiler or interpreter.
Related tasks
Documentation
Here_document
See also
Wikipedia
xkcd (Humor: hand gesture denoting // for "commenting out" people.)
| #Lilypond | Lilypond | % This is a comment
%{ This is a comment
spanning several lines %} |
http://rosettacode.org/wiki/Comments | Comments | Task
Show all ways to include text in a language source file
that's completely ignored by the compiler or interpreter.
Related tasks
Documentation
Here_document
See also
Wikipedia
xkcd (Humor: hand gesture denoting // for "commenting out" people.)
| #Lingo | Lingo | -- This is a comment.
-- This is another comment |
http://rosettacode.org/wiki/Conway%27s_Game_of_Life | Conway's Game of Life | The Game of Life is a cellular automaton devised by the British mathematician John Horton Conway in 1970. It is the best-known example of a cellular automaton.
Conway's game of life is described here:
A cell C is represented by a 1 when alive, or 0 when dead, in an m-by-m (or m×m) sq... | #Retro | Retro | :w/l [ $. eq? [ #0 ] [ #1 ] choose , ] s:for-each ;
'World d:create
'.................... w/l
'.................... w/l
'.................... w/l
'..ooo............... w/l
'....o............... w/l
'...o................ w/l
'.................... w/l
'.................... w/l
'.................... w/... |
http://rosettacode.org/wiki/Conditional_structures | Conditional structures | Control Structures
These are examples of control structures. You may also be interested in:
Conditional structures
Exceptions
Flow-control structures
Loops
Task
List the conditional structures offered by a programming language. See Wikipedia: conditionals for descriptions.
Common conditional structures include ... | #Jinja | Jinja |
print(Template("""{% for lang in ["Jinja", "Python", "Swift", "Nim"] %}
{{ loop.index }}) {{ lang }}{% if loop.last %}.{% else %},{% endif %}
{%- endfor %}""").render())
|
http://rosettacode.org/wiki/Comma_quibbling | Comma quibbling | Comma quibbling is a task originally set by Eric Lippert in his blog.
Task
Write a function to generate a string output which is the concatenation of input words from a list/sequence where:
An input of no words produces the output string of just the two brace characters "{}".
An input of just one word, e.g. ["AB... | #Vlang | Vlang | fn q(s []string) string {
match s.len {
0 {
return '{}'
}
1 {
return '{${s[0]}}'
}
2 {
return '{${s[0]} and ${s[1]}}'
}
else{
return '{${s[0..s.len-1].join(', ')} and ${s[s.len-1]}}'
}
}
}
fn main()... |
http://rosettacode.org/wiki/Comma_quibbling | Comma quibbling | Comma quibbling is a task originally set by Eric Lippert in his blog.
Task
Write a function to generate a string output which is the concatenation of input words from a list/sequence where:
An input of no words produces the output string of just the two brace characters "{}".
An input of just one word, e.g. ["AB... | #Wren | Wren | var quibbling = Fn.new { |w|
var c = w.count
if (c == 0) return "{}"
if (c == 1) return "{%(w[0])}"
if (c == 2) return "{%(w[0]) and %(w[1])}"
return "{%(w[0..-2].join(", ")) and %(w[-1])}"
}
var words = [ [], ["ABC"], ["ABC", "DEF"], ["ABC", "DEF", "G", "H"] ]
for (w in words) System.print(quibbl... |
http://rosettacode.org/wiki/Comments | Comments | Task
Show all ways to include text in a language source file
that's completely ignored by the compiler or interpreter.
Related tasks
Documentation
Here_document
See also
Wikipedia
xkcd (Humor: hand gesture denoting // for "commenting out" people.)
| #LiveCode | LiveCode | -- comment may appear anywhere on line
// comment may appear anywhere on line
# comment may appear anywhere on line
/* this is a
block comment that
may span any number of lines */ |
http://rosettacode.org/wiki/Comments | Comments | Task
Show all ways to include text in a language source file
that's completely ignored by the compiler or interpreter.
Related tasks
Documentation
Here_document
See also
Wikipedia
xkcd (Humor: hand gesture denoting // for "commenting out" people.)
| #Logo | Logo | ; comments come after a semicolon, and last until the end of the line |
http://rosettacode.org/wiki/Conway%27s_Game_of_Life | Conway's Game of Life | The Game of Life is a cellular automaton devised by the British mathematician John Horton Conway in 1970. It is the best-known example of a cellular automaton.
Conway's game of life is described here:
A cell C is represented by a 1 when alive, or 0 when dead, in an m-by-m (or m×m) sq... | #REXX | REXX | /*REXX program runs and displays the Conway's game of life, it stops after N repeats. */
signal on halt /*handle a cell growth interruptus. */
parse arg peeps '(' rows cols empty life! clearScreen repeats generations .
rows = p(rows 3) /*the ... |
http://rosettacode.org/wiki/Conditional_structures | Conditional structures | Control Structures
These are examples of control structures. You may also be interested in:
Conditional structures
Exceptions
Flow-control structures
Loops
Task
List the conditional structures offered by a programming language. See Wikipedia: conditionals for descriptions.
Common conditional structures include ... | #jq | jq | if cond then f else g end |
http://rosettacode.org/wiki/Comma_quibbling | Comma quibbling | Comma quibbling is a task originally set by Eric Lippert in his blog.
Task
Write a function to generate a string output which is the concatenation of input words from a list/sequence where:
An input of no words produces the output string of just the two brace characters "{}".
An input of just one word, e.g. ["AB... | #XBS | XBS | func task(a:array){
set x:string="";
foreach(k,v as a){
set out:string="";
if ((k==(?a-2))&((?a)>1)){out=" and "}elif(k!=(?a-1)){out=", "}
x+=v+out;del out;
}
send "{"+x+"}";
}
log(task([]));
log(task(["ABC"]));
log(task(["ABC","DEF"]));
log(task(["ABC","DEF","GHI"])); |
Subsets and Splits
Rosetta Code COBOL Python Hard Tasks
Identifies and retrieves challenging tasks that exist in both COBOL and Python, revealing cross-language programming patterns and difficulty levels for comparative analysis.
Rosetta Code Task Comparisons
Identifies tasks common to both COBOL and Python languages that are described as having difficulty levels, revealing cross-language task similarities and providing useful comparative programming examples.
SQL Code Examples from Training Data
Retrieves raw SQL code examples for the SQL language, which is basic data retrieval without meaningful analysis or patterns.
SQL Code Examples from Training Data
Retrieves raw SQL code examples for the SQL language, which is basic filtering that shows what data looks like but doesn't provide meaningful analysis or patterns.
Select Specific Languages Codes
Retrieves specific programming language names and codes from training data, providing basic filtering but limited analytical value beyond identifying these particular languages.