CJam Wiki
A stack-oriented programming language suitable for code golfing
Status: Alpha
Brought to you by:
aditsu
CJam uses the following data types:
long
(64-bit signed integer) and BigInteger
(arbitrary-precision integer), fluidly switching between them as needed. Example literals: 0
, -99999
, 123456789012345678901234567890
double
in C/java. Example literals: 1.23
, -.5
, 1234567890.
; note: scientific notation is not supported directly in literals, but "e
" followed by a numeric literal is also implemented as an infix operator with a similar meaning, therefore in many cases you can achieve the same result.char
in java; not a fully numeric type like in C. Example literals: 'A
, '$
, ''
- note the absence of a second single quote; the last example is the apostrophe/single quote character. There is no escape character.ArrayList<Object>
. Strings are just arrays of characters."hello"
, "foo\"bar"
, "a\b"
, "backslash: \\"
resulting in the strings: hello
, foo"bar
, a\b
, backslash: \
. The backslash character \
can be used for escaping double quotes and backslashes, nothing else. When followed by any other character, it is treated as a regular character.[1 2 "foo"]
but the square brackets are actually operators and not part of the syntax.{
and }
and treated as a single unit. Similar to code blocks in C/java, except blocks are first-class objects and can be assigned to variables (thus defining functions).