Strings must be double quotes
Switch statements are like normal with var for cases declared switch x { case x > 0: ... } but can also be done without so that cases are more like if conditionals then default at the end instead of else: switch { case 1 > 0: ... default: ...}
// While loop in Go
package main
import (
"fmt"
)
func main() {
a := 0
for a < 3 {
fmt.Println(a)
a++
}
}
Two ways to do conditionals:
CREATE TABLE booltest (a INTEGER, b INTEGER);
INSERT INTO booltest VALUES (1, 0);
SELECT * FROM booltest;
SELECT
CASE WHEN a THEN 'true' ELSE 'false' END as boolA,
CASE WHEN b THEN 'true' ELSE 'false' END as boolB
FROM booltest
;
SELECT
CASE a WHEN 1 THEN 'is true' ELSE 'is false' END AS boolA,
CASE b WHEN 1 THEN 'is true' ELSE 'is false' END AS boolB
FROM booltest
;
f(1)
object = { a: 1, func: (){ return this; }}
object.func();
func.call(object);
g = func.bind(object);
g()
function escapeHtml(text) {
return text
.replace(/&/g, "&")
.replace(/</g, "<")
.replace(/>/g, ">")
.replace(/"/g, """)
.replace(/'/g, "'");
}