Skip to content
falang.ioRU

Code projects

A code project draws an algorithm as a scheme whose icons hold ordinary source code in one language. Falang does not check or translate that code: it lays out the control flow (conditions, loops, exits) and assembles the text of the icons into a source file. Use it to design or document an algorithm visually and still get a file you can compile.

Choose the language when you create the project — Code (C++), Code (JavaScript), Code (TypeScript), Code (PHP) or Code (Rust). One project has one language. It can hold any number of schemes, in folders; a new project starts with one scheme called Main.

Every field is plain source code in the project’s language, edited with syntax highlighting.

  • Function — the scheme itself. Its top block is the function header, typed in full (for example int main() or fn main()); the bottom block is the final code, printed last (for example return 0;). Nothing is generated from the scheme name.

  • Action — one or more statements; several lines are fine.

  • If and While — only the condition, without the keyword and brackets: x > 0. “Switch true/false” in the context menu swaps which branch is the “true” one.

  • Switch — the value being switched on; each option holds its case value. An option with the value default becomes the default case.

  • For each — the whole loop header in the language’s own syntax, for example for (const x of items) , for x in items or foreach ($items as $x).

  • Cycle — no field: the body runs once, and a Continue inside it starts it again.

  • Break, Continue, Return (with an optional value) and Throw (with a value) — offered at the end of a branch or loop body, see Basics.

The code is not checked: there are no error marks while you type, and a mistake shows up only when you compile the generated file.

Choose Project → Export Code Documents. Every scheme of the project becomes one file in the project’s generated folder, named after the scheme (generated/Main.cpp, Main.rs, …). All files go into that one folder, whatever folders the schemes are in; characters that are not safe in a file name are replaced with _, and a duplicate name gets a short suffix. A progress window with a Cancel button is shown; an error in one scheme does not stop the others. Files are generated only by this command, not on save.

A scheme becomes the header, then a block with its icons and the final code:

int main()
{
if (x > 0) {
printf("yes\n");
} else {
continue;
}
while (i < 10) {
i++;
break;
}
return 0;
}
  • C++, JavaScript, TypeScript and PHP share the C-like form above. A Switch becomes switch with every case in its own { } block and no automatic break; — add an exit yourself where you need one. A Cycle becomes while (true) { … break; }. An else block is always written, even when its branch is empty.

  • PHP files are wrapped in <?php … ?>.

  • Rust: conditions have no brackets (if x > 0 {), a Switch becomes match with default written as _, a Cycle becomes loop { … break; }, and Throw becomes panic!(…).

  • Break and Continue always apply to the nearest loop; numbered exits from outer loops are not available in code projects.

Code projects get the same AI agent, coding-agent access, version history and PDF export as the other desktop projects.