GPTScript / AiScript

A Minimal, Full-Stack, Tool-Assisted Language. Native to Browsers and Bun. Strictly & Strongly-Typed.
https://github.com/GPTScript/AiScript
Mozilla Public License 2.0
9 stars 1 forks source link

One operation per line, more or less #15

Open coolaj86 opened 2 years ago

coolaj86 commented 2 years ago

This is for readability.

We don't want lots of symbols and we don't want clearly distinct, different things happening all together.

Bad Examples

let x = (thing1(), thing2());
if (arr.some(function (el) {
  return el.foo;
})) {
  // do stuff
}
arr.push(await doStuff());

Good Examples

thing1();

let x = thing2();
let hasFoo =  arr.some(function (el) {
  return el.foo;
});

if (hasFoo) {
  // do stuff
}
let result = await doStuff();
arr.push(result);