psCrumbReference

psLangTitle

psLangIntro

psLangCommentsTitle

psLangCommentsP

// line comment — runs to end of line

/* block comment
   spanning multiple lines */

psLangLiteralsTitle

psLangThTypepsLangThExamplespsLangThNotes
Int 0, 42, 100 psLangLitIntNote
Float 2.45, 149.99 psLangLitFloatNote
String "Hello" psLangLitStrNote
Bool true, false  
Null null psLangLitNullNote
Map {} psLangLitMapNote

psLangEscTitle

psLangEscP

psLangThEscapepsLangThProduces
\npsLangEscNewline
\tpsLangEscTab
\\psLangEscBackslash
\"psLangEscQuote
\{   \}psLangEscBraces

psLangVarTitle

psLangVarP

var token   = util$.uuid();
var total   = 149.99;
var summary = {};          // empty map

total = total + 10;        // reassignment
psLangVarNoteLabel psLangVarNote

psLangMapsTitle

psLangMapsP1

var item = {};
item["name"]  = "Pencil";
item["price"] = 2.45;

context$.log("name = {}", item["name"]);   // Pencil
context$.log("qty  = {}", item["qty"]);     // null (absent)

psLangMapsP2

context$.log("A.B = {}", param$["A"]["B"]);

psLangOpTitle

psLangOpArithTitle

psLangOpArithP

psLangOpCmpTitle

psLangOpCmpP

psLangOpEqTitle

psLangOpEqP

if (model == null) {
    model = PSEntity(className);
    model.identifier(idn);
}

psLangTruthTitle

psLangTruthP

psLangCtrlTitle

if

psLangCtrlIfP

if (count > 100) {
    router$.allow("bulk_connector");
}
psLangCtrlNoElseLabel psLangCtrlNoElse

for

psLangCtrlForP

for (var i = 0; i < 50; i = i + 1) {
    var e = PSEntity("com.paradicshift.test.GISTempData");
    e.identifier("GIS-TEMP-%s".formatted(util$.uuid()));
    data$.persist(e);
}

psLangErrTitle

psLangErrP

try {
    context$.log("Starting risky step.");
    data$.persist({});                 // throws: not an entity
    context$.log("skipped on error");
} catch (err) {
    context$.log("The step failed: {}", err);
    output$["status"] = "handled";
} finally {
    context$.log("Cleanup always runs.");
}
psLangErrNoteLabel psLangErrNote

psLangStrTitle

psLangStrP

.replace(from, to)

psLangStrReplaceP

var s = "Hello {a}";
context$.log("{}", s.replace("{a}", "abc"));   // Hello abc

.formatted(args…)

psLangStrFmtP

psLangThSpecifierpsLangThMeaning
%spsLangFmtS
%SpsLangFmtSU
%dpsLangFmtD
%fpsLangFmtF
%bpsLangFmtB
%%psLangFmtPct
var url = "%s/icons/%s.svg".formatted(baseURL, name);
e.gis("location", "POINT(%f %f)".formatted(lon, lat));
psLangStrTipLabel psLangStrTip