Civet language preview
1. Declarations and comments
the := declaration operator and block/line comments
horizon-dark
### block comment
describing this snippet ###
x := 1 # single-line comment
double := (n) -> n * 2
result := x |> double
unless result is 0
console.log "not zero"
add := (a, b) => a + b
@name = "civet" atom-one-dark
### block comment
describing this snippet ###
x := 1 # single-line comment
double := (n) -> n * 2
result := x |> double
unless result is 0
console.log "not zero"
add := (a, b) => a + b
@name = "civet" github-dark
### block comment
describing this snippet ###
x := 1 # single-line comment
double := (n) -> n * 2
result := x |> double
unless result is 0
console.log "not zero"
add := (a, b) => a + b
@name = "civet" dracula
### block comment
describing this snippet ###
x := 1 # single-line comment
double := (n) -> n * 2
result := x |> double
unless result is 0
console.log "not zero"
add := (a, b) => a + b
@name = "civet" nord
### block comment
describing this snippet ###
x := 1 # single-line comment
double := (n) -> n * 2
result := x |> double
unless result is 0
console.log "not zero"
add := (a, b) => a + b
@name = "civet" github
### block comment
describing this snippet ###
x := 1 # single-line comment
double := (n) -> n * 2
result := x |> double
unless result is 0
console.log "not zero"
add := (a, b) => a + b
@name = "civet" 2. Word operators
unless, until, loop, and isnt
horizon-dark
until count is 10
count := count + 1
loop
break unless active
if value isnt null and value is not 0
process value atom-one-dark
until count is 10
count := count + 1
loop
break unless active
if value isnt null and value is not 0
process value github-dark
until count is 10
count := count + 1
loop
break unless active
if value isnt null and value is not 0
process value dracula
until count is 10
count := count + 1
loop
break unless active
if value isnt null and value is not 0
process value nord
until count is 10
count := count + 1
loop
break unless active
if value isnt null and value is not 0
process value github
until count is 10
count := count + 1
loop
break unless active
if value isnt null and value is not 0
process value 3. Pipe chains
the |> operator chaining function calls
horizon-dark
result := [1, 2, 3]
|> filter (n) -> n > 1
|> map (n) -> n * 10
|> reduce (a, b) -> a + b atom-one-dark
result := [1, 2, 3]
|> filter (n) -> n > 1
|> map (n) -> n * 10
|> reduce (a, b) -> a + b github-dark
result := [1, 2, 3]
|> filter (n) -> n > 1
|> map (n) -> n * 10
|> reduce (a, b) -> a + b dracula
result := [1, 2, 3]
|> filter (n) -> n > 1
|> map (n) -> n * 10
|> reduce (a, b) -> a + b nord
result := [1, 2, 3]
|> filter (n) -> n > 1
|> map (n) -> n * 10
|> reduce (a, b) -> a + b github
result := [1, 2, 3]
|> filter (n) -> n > 1
|> map (n) -> n * 10
|> reduce (a, b) -> a + b