WARNING: This document will not teach you to program.
This document collects the basic commands, operators, and other good stuff the disc language has to offer in a no-nonsense listing. This will not teach you how to program, how to be a better programmer, or how to program differently. It's just a list of things and what they do. Thanks for your attention.
define PI as 3.14159
let clifford be "Big red dog"
update count to count + 1
if count isEqualTo 3
print: "Count is three"
end
if count isEqualTo 3
print: "Count is three"
else if count isGreaterThan 5
print: "No, no, MUCH bigger than 3"
end
if count isEqualTo 3
print: "Count is three"
else if count isGreaterThan 5
print: "No, no, MUCH bigger than 3"
else
print: "No, it's far smaller than 3"
end
loop while count isLessThan 5
print: join: "Looping to five. Current count: " count
end
repeat while count isLessThan 5
print: join: "Looping to five. Current count: " count
end
+, -, *, /
true
when the value on the left is less than the one on the right,
otherwise false
.
5 isLessThan 12 # produces true
7 isLessThan -3 # produces false
true
when the value on the left is either less, or equal to than the one
on the right, otherwise false
.
5 isLessOrEqualTo 12 # produces true
7 isLessOrEqualTo 7 # produces true
7 isLessOrEqualTo -2 # produces false
true
when the value on the left is less than the one on the right,
otherwise false
.
5 isGreaterThan 12 # produces false
7 isGreaterThan -3 # produces true
true
when the value on the left is either less, or equal to than the one
on the right, otherwise false
.
5 isGreaterOrEqualTo 12 # produces false
7 isGreaterOrEqualTo 7 # produces true
7 isGreaterOrEqualTo -2 # produces true
true
when values are equal, otherwise false
.
7 isEqualTo 7 # produces true
"this is fine" isEqualTo "this is fine" # produces true
7 isEqualTo -2 # produces false
"this is fine" isEqualTo "this is not fine" # produces false
... and ..., ... or ...
(count isLessThan 3) and (count isGreaterThan 0)
(count isLessThan 3) or (count isGreaterThan 0)
...
let numberIsInRange be ...
number isLessThan 5 ...
and number isGreaterThan -5
declare function displayScore withParameters wins losses ties
call clear
print: join: "wins: " wins " losses: " losses " ties: " ties
end
declare function displayRandomNumber
print: random: 0 100
end
let myArray be (call newArray)
let myArray be (call newArray with 1 2 3 4)
...: ...
let myArray be (newArray:)
let myArray be (newArray: 1 2 3 4)
# without toInfix
join: "a left-handed string" "a right-handed string"
# with toInfix
toInfix "a left-handed string" join "a right-handed string"
:: ...
toInfix
# without :: (toInfix)
join: "a left-handed string" "a right-handed string"
# with :: (toInfix)
:: "a left-handed string" join "a right-handed string"