code2flow employs a flowchart programming language that inherits its syntax structure from the C programming language although usage of natural language makes it easily usable for non-progammers.
Open below sections for more details
Expressions state something that happens at given point in a flowchart. Starting and ending (terminating) expressions are automatically marked as such.
Below example shows three consecutive actions. Each expression
needs to be separated by a semicolon(
;), otherwise they are joined and create a single expression. You can click on the code, edit it and see the updated flowchart.
Note that notion of action in flowcharts has been traditionally called process.
Any text, be it in expressions, comments or other type of clock can be formatted. Formatting styles below:
- Bold -
**some text**will create some text.
- Italic -
*some text*will create some text.
- Bold italic -
***some text***will create some text.
- Monospace -
`some text`will create
some text. This is useful for embedding code-like operations in the flowchart.
Please notice the whitespace handling in below example.
Longer monospace fragments will stay aligned to the left.
Decision blocks allow for splitting process into two paths, one following successful/true outcome of the statement and other unsucessful/false outcome. The labels for both "True" and "False" can be adjusted as will be shown below. Using
else if one can chain several consecutive conditions and with final
else all other cases can be met.
} is optional if using only one expression.
Returning can be used to abrubtly stop continuation after given process. Other use case is showing two separate flowcharts on one document.
As you can see "Show BIOS" is another terminating node now. This is simplified case and could be rewritten with
else but it is necessary in more complicated cases.
switch is used to model more complex decisions where an outcome is based on more than true or false evaluation.
There can be arbitrary number of outcomes.
Specify each case with the
case keyword and follow it by text.
Write normal code inside and usually you want to end it with
break that jumps out of the switch. If not provided, you will see the two cases linked. Try removing the
break from line
5 of the next example to see this behaviour.
Example shows two cases being handled separately and two other cases being handled together.
switch being modelled after C language may behave in peculiar way:
As you can see, there is a "fall-through" behaviour and without an explicit break a case will link to the next case. It is useful for more compact representation of logic.
Goto, loop and loop labels allow jumping from the place where
goto is called to the place after label declaration. Labels are declared by writing a short no-spaced English string and ending it with
:. Loop is performed by providing the label name after the
goto keywords as shown in the next example.
loop is the synonym of
To change the layout depending on your need you could also use
nop command that creates a small circle as an intermediary node.
Layout becomes bigger but the loop is now more apparent.
Several loops can be used simultaneously.
Simple looping can be achieved more easily. Consider the smiling example from previous section. It can be improved in the following way.
Much shorter and more readable. Note that in this version the client has to be unhappy in the first place for you to smile. Let's change it.
In the second example the condition happens at the end of the loop which is required depending on given process.
With the keyword
break you can terminate a loop at any given point.
continue keyword allows to jump to the beginning of the loop.
Other shapes can be enforced by putting specific characters at beginning and the end of the expression.
Other shapes have semantic meaning, use them according to the needs;
Every expression, condition and loop may be provided with a text that will appear by the line connections coming out of it. When used with expressions it could be understood as something yielding a result, for example:
Branches could be understood in terms of creating another process that occurs in parallel to the default one.
They "live" totally separately and may have separate ends.
To connect the ends of the branches to the main process a
join statement is called with comma separated list of branch names. Consider this example.
Arbitrary amount of branches can be created provided each is given a separate name.
Braces are usually entirely optional. The only exceptions are short-hand
if written without using