Data update
This commit is contained in:
parent
4d5544505c
commit
4924dd0264
3073 changed files with 55820 additions and 4408 deletions
|
|
@ -0,0 +1,20 @@
|
|||
(if (> (+ 5 4) 7)
|
||||
# then
|
||||
(print "5+4 > 7")
|
||||
# else
|
||||
(print "something has gone terribly wrong"))
|
||||
|
||||
(if (not true)
|
||||
{
|
||||
# this is a serie of expressions inside the 'then' block of the conditional
|
||||
(print "true is... not true?")
|
||||
(foo bar 5)
|
||||
(+ 5 4) }
|
||||
{
|
||||
# the 'else' block can also have multiple expressions in it
|
||||
(print "something")
|
||||
(print "is weird") })
|
||||
|
||||
# conditions can be used as expressions too
|
||||
(let n (if (> 5 6) "error" "5 < 6"))
|
||||
(print n)
|
||||
|
|
@ -0,0 +1 @@
|
|||
CASE WHEN cond THEN x ELSE y END;
|
||||
|
|
@ -0,0 +1 @@
|
|||
CASE value [WHEN x THEN y]+ ELSE z END;
|
||||
|
|
@ -0,0 +1 @@
|
|||
SELECT CASE x WHEN (x IS NULL) THEN 'null' ELSE 'nonnull' END FROM (SELECT null as x);
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
local val = 1
|
||||
if val > 2 then
|
||||
print("a")
|
||||
elseif val == 2 then
|
||||
print("b")
|
||||
else
|
||||
print("c")
|
||||
end
|
||||
|
||||
val = 123
|
||||
switch val do
|
||||
case 1: print(1); break
|
||||
case 2: print(2); break
|
||||
default: print(123)
|
||||
end
|
||||
|
||||
-- Hash-based conditionals
|
||||
local t = {
|
||||
["one"] = function() print("one") end,
|
||||
["two"] = function() print("two") end
|
||||
}
|
||||
-- (default)
|
||||
setmetatable(t, {
|
||||
__index = function(_) print("default") return function() end end
|
||||
})
|
||||
|
||||
t["one"]()
|
||||
t["two"]()
|
||||
t["100000"]()
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
? i < 0
|
||||
i =: 0
|
||||
|
|
||||
i =: 42
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
\C
|
||||
if i < 0
|
||||
i = 0
|
||||
else
|
||||
i = 42
|
||||
|
|
@ -0,0 +1 @@
|
|||
i =: ?( i<0 ?! 0 ?: 42 ?)
|
||||
Loading…
Add table
Add a link
Reference in a new issue