-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
966 lines (955 loc) · 49.4 KB
/
index.html
File metadata and controls
966 lines (955 loc) · 49.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="theme-color" content="#000000">
<meta name="description" content="Create and run programs using flow charts">
<meta name="keywords" content="flowchart, teaching tools, programming language for beginners, pwa">
<meta name="author" content="Federico Dossena">
<meta name="image" content="https://fdossena.com/flogo/cover.jpg">
<title>Flogo</title>
<link rel="icon" type="image/png" href="/images/favicon.png">
<style type="text/css">
body {
overflow: hidden;
}
#loadOverlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: black;
z-index: 99999;
}
#loadingSpinner {
position: absolute;
left: calc(50vw - clamp(1rem, 10vmin, 4rem) / 2);
top: calc(50vh - clamp(1rem, 10vmin, 4rem) / 2);
width: clamp(1rem, 10vmin, 4rem);
height: clamp(1rem, 10vmin, 4rem);
background: conic-gradient(white, black);
border-radius: 9999rem;
position: relative;
animation: loading 1s linear infinite;
}
#loadingSpinner::after {
content: "";
display: block;
background: black;
top: 7.5%;
left: 7.5%;
right: 7.5%;
bottom: 7.5%;
position: absolute;
border-radius: 9999rem;
}
@keyframes loading {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(-360deg);
}
}
@media (prefers-color-scheme: light) {
#loadOverlay,
#loadingSpinner::after {
background: white;
}
#loadingSpinner {
background: conic-gradient(black, white);
}
}
</style>
</head>
<body class="notranslate">
<div id="loadOverlay">
<div id="loadingSpinner"></div>
<noscript>
This app requires JavaScript to be enabled in your browser. Don't worry, it's <a href="https://github.com/adolfintel/flogo" target="_blank">free and open source</a> software 😉
</noscript>
</div>
<div id="bar">
<span id="expandBar" class="expandCollapse"><span class="icon material-icons-sharp">expand_more</span>More</span>
<span id="collapseBar" class="expandCollapse"><span class="icon material-icons-sharp">expand_less</span>Less</span>
<div id="bar_contents">
<span class="group">
<button id="newProgram" title="New"><span class="icon material-icons-sharp">note_add</span></button>
<button id="loadProgram" title="Load"><span class="icon material-icons-sharp">folder_open</span></button>
<button id="saveProgram" title="Save"><span class="icon material-icons-sharp">save_as</span></button>
<input type="file" id="filePicker" accept=".flogo">
</span>
<span class="group">
<button id="runProgram" title="Run"><span class="icon material-icons-sharp">play_arrow</span></button>
<button id="pauseProgram" title="Pause"><span class="icon material-icons-sharp">pause</span></button>
<button id="stopProgram" title="Stop"><span class="icon material-icons-sharp">stop</span></button>
</span>
<span class="group">
<span class="icon material-icons-sharp">bolt</span><select id="executionMode" title="Execution speed">
<option value="turbo">Turbo</option>
<option value="normal" selected>Normal</option>
<option value="slow">Slow</option>
<option value="step">Manual</option>
</select>
</span>
<span class="group">
<button id="undo" title="Undo"><span class="icon material-icons-sharp">undo</span></button>
<button id="redo" title="Redo"><span class="icon material-icons-sharp">redo</span></button>
</span>
<span id="bar_settings" class="group">
<button id="openManual" title="Manual"><span class="icon material-icons-sharp">question_mark</span></button>
<button id="openSettings" title="Settings"><span class="icon material-icons-sharp">settings</span></button>
</span>
</div>
</div>
<div id="fps"></div>
<div id="flowchartArea"></div>
<div id="variablesArea">
<div id="variablesWrapper">
<div class="sideHeader">Variables</div>
<div id="variableList"></div>
</div>
</div>
<div id="variablesExpander" class="expander"><span id="variablesExpander_icon" class="icon material-icons-sharp">list</span><span class="text">Variables</span></div>
<div id="consoleArea">
<div id="logWrapper">
<div class="sideHeader">
Console
<button id="console_save" title="Save text"><span class="icon material-icons-sharp">download</span></button>
</div>
<div id="log"></div>
</div>
<div id="inputArea">
<textarea id="input" disabled></textarea>
<button id="input_send" disabled><span class="icon material-icons-sharp">send</span></button>
</div>
</div>
<div id="consoleExpander" class="expander"><span id="consoleExpander_icon" class="icon material-icons-sharp">chat_bubble</span><span class="text">Console</span></div>
<div id="turtleArea" class="window">
<div class="window_bar">
<div class="window_title">Turtle graphics</div>
<div class="window_buttons">
<button id="turtle_openMenu"><span class="icon material-icons-sharp">menu</span></button>
<button id="turtle_hide"><span class="icon material-icons-sharp">close</span></button>
</div>
</div>
<div id="turtle_canvas" class="window_contents"></div>
</div>
<div id="turtleMenu" class="popup">
<div id="turtleMenu_savePNG"><span class="icon material-icons-sharp">image</span>Save as PNG</div>
<div id="turtleMenu_hideCursor"><span class="icon material-icons-sharp">visibility_off</span>Hide turtle</div>
<div id="turtleMenu_showCursor"><span class="icon material-icons-sharp">visibility</span>Show turtle</div>
</div>
<div id="popupBackdrop"></div>
<div id="insertWide" class="popup"></div>
<div id="insertTall" class="popup"></div>
<div id="crash" class="popup">
<div class="autoVert">
<div id="crash_title"><span class="icon material-icons-sharp">report_problem</span>Program crashed!</div>
<div id="crash_details"></div>
</div>
<div id="crash_buttons">
<button class="important closePopup">Ok</button>
</div>
</div>
<div id="loadError" class="popup">
<div class="autoVert">
<div id="loadError_title"><span class="icon material-icons-sharp">file_download_off</span>Loading failed</div>
<div id="loadError_details"></div>
</div>
<div id="loadError_buttons">
<button class="important closePopup">Ok</button>
</div>
</div>
<div id="editor" class="popup noAutoClose">
<div id="editor_Input">
<div class="editor_graphics_container">
<div class="editor_graphics" flogo_instruction="Input"></div>
<div class="editor_graphics_description">An input instruction reads a value from the user and stores it in a variable</div>
</div>
<div class="autoVert">
<label for="editor_Input_variable">Variable</label>
<input type="text" flogo_attr="variable" id="editor_Input_variable" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">
</div>
</div>
<div id="editor_Output">
<div class="editor_graphics_container">
<div class="editor_graphics" flogo_instruction="Output"></div>
<div class="editor_graphics_description">An output instruction evaluates an expression and shows the result to the user</div>
</div>
<div class="autoVert">
<label for="editor_Output_expression">Expression</label>
<textarea id="editor_Output_expression" flogo_attr="expression" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></textarea>
<div>
<input type="checkbox" id="editor_Output_newLine" flogo_attr="newLine">
<label for="editor_Output_newLine">New line</label>
</div>
</div>
</div>
<div id="editor_Assign">
<div class="editor_graphics_container">
<div class="editor_graphics" flogo_instruction="Assign"></div>
<div class="editor_graphics_description">An assignment instruction evaluates an expression and stores the result in a variable</div>
</div>
<div class="autoVert">
<label for="editor_Assign_variable">Variable</label>
<input type="text" flogo_attr="variable" id="editor_Assign_variable" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">
<label for="editor_Assign_expression" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">Expression</label>
<textarea id="editor_Assign_expression" flogo_attr="expression" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></textarea>
</div>
</div>
<div id="editor_If">
<div class="editor_graphics_container">
<div class="editor_graphics" flogo_instruction="If"></div>
<div class="editor_graphics_description">An if instruction evaluates an expression and executes the true or false branch depending on the result</div>
</div>
<div class="autoVert">
<label for="editor_If_condition">Condition</label>
<textarea id="editor_If_condition" flogo_attr="condition" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></textarea>
</div>
</div>
<div id="editor_DoWhile">
<div class="editor_graphics_container">
<div class="editor_graphics" flogo_instruction="DoWhile"></div>
<div class="editor_graphics_description">A Do-While loop repeats the instructions inside it until the expression becomes false, the expression is evaluated at the end of each loop</div>
</div>
<div class="autoVert">
<label for="editor_DoWhile_condition">Condition</label>
<textarea id="editor_DoWhile_condition" flogo_attr="condition" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></textarea>
</div>
</div>
<div id="editor_While">
<div class="editor_graphics_container">
<div class="editor_graphics" flogo_instruction="While"></div>
<div class="editor_graphics_description">A While loop repeats the instructions inside it until the expression becomes false, the expression is evaluated before each loop</div>
</div>
<div class="autoVert">
<label for="editor_While_condition">Condition</label>
<textarea id="editor_While_condition" flogo_attr="condition" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></textarea>
</div>
</div>
<div id="editor_For">
<div class="editor_graphics_container">
<div class="editor_graphics" flogo_instruction="For"></div>
<div class="editor_graphics_description">A for loop automatically increments or decrements a variable, usually a counter, through a range of values</div>
</div>
<div class="autoVert">
<label for="editor_For_variable">Variable</label>
<input type="text" flogo_attr="variable" id="editor_For_variable" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">
<div class="autoHor">
<div class="autoVert">
<label for="editor_For_from">From</label>
<textarea id="editor_For_from" flogo_attr="from" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></textarea>
</div>
<div class="autoVert">
<label for="editor_For_to">To</label>
<textarea id="editor_For_to" flogo_attr="to" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></textarea>
</div>
</div>
<div class="autoHor">
<div class="autoVert">
<label for="editor_For_direction">Direction</label>
<select id="editor_For_direction" flogo_attr="direction">
<option value="up">Increasing</option>
<option value="down">Decreasing</option>
</select>
</div>
<div class="autoVert">
<label for="editor_For_step">Step</label>
<textarea id="editor_For_step" flogo_attr="step" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></textarea>
</div>
</div>
</div>
</div>
<div id="editor_Comment">
<div class="editor_graphics_container">
<div class="editor_graphics" flogo_instruction="Comment"></div>
<div class="editor_graphics_description">Comments have no effect on your program, they are useful to store notes or to document how you solved a problem</div>
</div>
<div class="autoVert">
<label for="editor_Comment_text">Text</label>
<textarea id="editor_Comment_text" flogo_attr="text"></textarea>
</div>
</div>
<div id="editor_Breakpoint">
<div class="editor_graphics_container">
<div class="editor_graphics" flogo_instruction="Breakpoint"></div>
<div class="editor_graphics_description">The program will automatically pause here</div>
</div>
</div>
<div id="editor_Move">
<div class="editor_graphics_container">
<div class="editor_graphics" flogo_instruction="Move"></div>
<div class="editor_graphics_description">A Move/Draw instruction moves the turtle by the specified distance. You can choose whether to draw a line to the new location or not</div>
</div>
<div class="autoVert">
<label for="editor_Move_expression">Expression</label>
<textarea id="editor_Move_expression" flogo_attr="expression" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></textarea>
<div>
<input type="checkbox" id="editor_Move_draw" flogo_attr="draw">
<label for="editor_Move_draw">Draw</label>
</div>
</div>
</div>
<div id="editor_Turn">
<div class="editor_graphics_container">
<div class="editor_graphics" flogo_instruction="Turn"></div>
<div class="editor_graphics_description">A Turn instruction changes the angle of the turtle by the specified amount of degrees, turning it either right (clockwise) or left (counter-clockwise)</div>
</div>
<div class="autoVert">
<label for="editor_Turn_expression">Expression (degrees)</label>
<textarea id="editor_Turn_expression" flogo_attr="expression" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></textarea>
<div>
<label for="editor_Turn_direction">Direction</label>
<select id="editor_Turn_direction" flogo_attr="direction">
<option value="cw">Right</option>
<option value="ccw">Left</option>
</select>
</div>
</div>
</div>
<div id="editor_Home">
<div class="editor_graphics_container">
<div class="editor_graphics" flogo_instruction="Home"></div>
<div class="editor_graphics_description">The turtle will return to the center of the drawing area, pointing upwards</div>
</div>
</div>
<div id="editor_buttons">
<button id="edit_confirm" class="important">Ok</button>
<button id="edit_cancel">Cancel</button>
</div>
</div>
<div id="editor2" class="popup">
<div id="editor2_edit"><span class="icon material-icons-sharp">create</span>Edit</div>
<div id="editor2_addToSelection"><span class="icon material-icons-sharp">add</span>Select</div>
<div id="editor2_removeFromSelection"><span class="icon material-icons-sharp">remove</span>Deselect</div>
<div id="editor2_cut"><span class="icon material-icons-sharp">content_cut</span>Cut</div>
<div id="editor2_copy"><span class="icon material-icons-sharp">content_copy</span>Copy</div>
<div id="editor2_delete"><span class="icon material-icons-sharp">delete</span>Delete</div>
</div>
<div id="yesno" class="popup">
<div class="autoVert">
<div id="yesno_title"><span class="icon material-icons-sharp">delete_forever</span><span id="yesno_title_text"></span></div>
<div id="yesno_details"></div>
</div>
<div id="yesno_buttons">
<button id="yesno_yes" class="danger">Yes</button>
<button id="yesno_no" class="important">No</button>
</div>
</div>
<div id="settings" class="popup noAutoClose">
<div id="settings_tabSelector">
<div for="program_metadata" settings_selectTab="program_metadata">Program</div>
<div for="settings_style" settings_selectTab="settings_style">Style</div>
<div for="settings_export" settings_selectTab="settings_export">Export</div>
<div for="settings_advanced" settings_selectTab="settings_advanced">Advanced</div>
<div for="settings_about" settings_selectTab="settings_about">About</div>
</div>
<div id="settings_tabs">
<div id="program_metadata" class="settings_tab">
<p class="settings_desc">
Information about your program. This will be saved into the program when you save it.
</p>
<div class="autoVert">
<label for="metadata_title">Title</label>
<input type="text" id="metadata_title">
<label for="metadata_author">Author</label>
<input type="text" id="metadata_author">
</div>
<div class="settings_tab_buttons">
<button class="important" id="settings_updateMetadata">Save</button>
<button class="closePopup">Close</button>
</div>
</div>
<div id="settings_style" class="settings_tab">
<p class="settings_desc">
Choose a theme for the application. This setting will be saved for the current user, but not in your program.
</p>
<div>
<label for="style_theme_select">Theme</label>
<select id="style_theme_select">
<optgroup label="Dark">
<option value="default_dark">🌘 Default</option>
<option value="night_dark">🌘 Night city</option>
<option value="alchemy_dark">🌘 Alchemy</option>
<option value="glass_dark">🌘 Glass</option>
</optgroup>
<optgroup label="Light">
<option value="default_light">☀️ Default</option>
<option value="colorful_light">☀️ Colorful</option>
<option value="sakura_light">☀️ Sakura</option>
</optgroup>
<optgroup label="Special">
<option value="eink_light">E-Ink</option>
</optgroup>
</select>
</div>
<div class="settings_tab_buttons">
<button class="closePopup">Close</button>
</div>
</div>
<div id="settings_export" class="settings_tab">
<p class="settings_desc">
Save the flow chart as an image, so you can put it in your documents or web pages. Note that exported programs are just images and you won't be able to open them in Flogo.
</p>
<div>
<div>
<label for="export_format">Export as</label>
<select id="export_format">
<option id="export_format_svg" value="svg">SVG</option>
<option value="png" selected>PNG</option>
</select>
</div>
<div>
<input type="checkbox" id="export_background" checked><label for="export_background">Keep background color</label>
</div>
</div>
<div class="settings_tab_buttons">
<button class="important" id="settings_export_button">Export</button>
<button class="closePopup">Close</button>
</div>
</div>
<div id="settings_advanced" class="settings_tab">
<p class="settings_desc">
Don't touch these unless you know what you're doing.
</p>
<div class="autoVert">
<div>
<input type="checkbox" id="settings_fps"><label for="settings_fps">FPS counter</label><br>
<input type="checkbox" id="settings_altTurboTSlice"><label for="settings_altTurboTSlice">Longer timeslice in turbo mode (for low-end PCs)</label><br>
<input type="checkbox" id="settings_unlimitedConsole"><label for="settings_unlimitedConsole">Don't delete old messages in the console (can cause lag)</label><br>
<input type="checkbox" id="settings_unlimitedTurtle"><label for="settings_unlimitedTurtle">Don't delete old lines in Turtle Graphics (can cause lag)</label><br>
<input type="checkbox" id="settings_unlimitedArrayView"><label for="settings_unlimitedArrayView">Don't truncate long arrays in variable list (can cause lag)</label><br>
<input type="checkbox" id="settings_disableCulling"><label for="settings_disableCulling">Disable flowchart culling (can cause lag)</label>
</div>
</div>
<div class="settings_tab_buttons">
<button class="closePopup">Close</button>
</div>
</div>
<div id="settings_about" class="settings_tab">
<div class="autoVert">
<div><img src="images/logo_large.webp" id="about_logo" alt="Logo"></div>
<div>Flogo – Version <span id="versionNumber"></span><span id="versionTypeBadge"></span></div>
<div id="devBuildInfo"></div>
<div>Made with ❤️ by <a href="https://fdossena.com" target="_blank">Federico Dossena</a></div>
<div>Distributed under the <a id="showLicense">GNU AGPL v3</a> license</div>
<div><a href="https://fdossena.com/?p=flogo/index.frag" target="_blank">Website</a> | <a href="https://github.com/adolfintel/flogo" target="_blank">GitHub</a></div>
</div>
<div class="settings_tab_buttons">
<button class="closePopup">Close</button>
</div>
</div>
</div>
</div>
<div id="toasts"></div>
<div id="man" class="popup noAutoClose">
<div id="man_contents">
<img src="images/logo_large.webp" id="man_logo">
<h1>Manual</h1>
<ul>
<li><a man_scrollTo="variables">Variables and types</a></li>
<li><a man_scrollTo="instructions">Basic instructions</a></li>
<li>
<a man_scrollTo="expressions">Expressions</a>
<ul>
<li><a man_scrollTo="operators1">Mathematical operators</a></li>
<li><a man_scrollTo="operators2">Comparison operators</a></li>
<li><a man_scrollTo="operators3">Logical operators</a></li>
<li><a man_scrollTo="functions">Built-in functions</a></li>
<li><a man_scrollTo="constants">Built-in constants</a></li>
</ul>
</li>
<li><a man_scrollTo="arrays">Arrays</a></li>
<li><a man_scrollTo="turtle">Graphics</a></li>
</ul>
<a name="variables"></a>
<h2>Variables and types</h2>
<h3>Variables</h3>
<p>
Variables can be used to store data that your program needs to work.<br>
Each variable has:
</p>
<ul>
<li><b>Name</b>: a short name that lets you use the variable in expressions. Names can only contain letters and numbers and the underscore symbol "_" and must start with a letter. Spaces, symbols and accented letters are not allowed. Also, variables can't have the same name as one of the <a man_scrollTo="constants">built-in constants</a>. Names are case-sensitive, meaning that the variable <code>n</code> is not the same as the variable <code>N</code>.</li>
<li><b>Type</b>: what kind of value can be stored in the variable: Integer, Real, String, Boolean or Array</li>
<li><b>Initial value</b>: if you want, you can give a value to the variable automatically when the program starts. This is useful for things like counters that have to start at 0, or for constants such as a speed limit</li>
</ul>
<h3>Types</h3>
<h4>Integer</h4>
<p>
Can be used to store integer numbers, positive or negative.<br>
If a real number is stored into an integer, the decimal digits are lost.
</p>
<p>
Valid values for an integer are <code>-9007199254740991</code> to <code>9007199254740991</code>.
</p>
<h4>Real</h4>
<p>
Can be used to store real numbers, positive or negative.
</p>
<p>
Real numbers don't have a valid range, but they lose accuracy as they become larger.<br>
It is generally a bad idea to store an integer number in a real variable.
</p>
<h4>String</h4>
<p>
Can be used to store text. The maximum allowed length is `1048576` characters (about 1 million).
</p>
<h4>Boolean</h4>
<p>
Can store a value that's either <code>true</code> or <code>false</code>.
</p>
<h4>Array</h4>
<p>
Can store multiple values of the same basic type. See <a man_scrollTo="arrays">Arrays</a>.
</p>
<a name="instructions"></a>
<h2>Basic instructions</h2>
<h4>Input</h4>
<p>
Reads a value from the user and stores it in a variable.
</p>
<h4>Output</h4>
<p>
Evaluates an expression and shows the result to the user.
</p>
<ul>
<li><b>Expression</b>: what you want to output. You can output text directly by putting it in "double quotes", you can output variables by typing their name, or you can do a mix of text and variables using the <code>+</code> symbol. Example: <code>"The total is "+total+"€"</code></li>
<li><b>New line</b>: by default, each output instruction creates a new bubble in the chat. If you turn this off, the next output will be added to the bubble created by this one</li>
</ul>
<h4>Assign</h4>
<p>
Evaluates an expression and stores the result in a variable.
</p>
<ul>
<li><b>Variable</b>: the variable where you want to put the result of the expression</li>
<li><b>Expression</b>: the expression to evaluate. You can use numbers, variables, mathematical operators, functions, etc.</li>
</ul>
<p>
Be careful! Some automatic type conversions can happen if variables are not of the same type. For instance, if the expression gives a real value but your variable is an integer, it will lose the decimal digits; if the expression gives an integer number and your variable is a string, it will be converted to text. Your program only crashes if the types are completely incompatible, for instance if your expression gives a string but you're trying to store it in a real variable.
</p>
<h4>If</h4>
<p>
Evaluates an expression and executes the True or False branch depending on the result.<br>
The expression can contain numbers, variables, mathematical operators, etc. but it can also contain comparison and logical operators. For instance, the expression <code>a>=0&&a<=10</code> tells you if the variable <code>a</code> is between <code>0</code> and <code>10</code>.
</p>
<p>
It's important to remember that the expression must give a true/false value, any other type will crash your program.
</p>
<h4>Do-While</h4>
<p>
Repeats the instructions inside it until the condition at the end becomes false.<br>
The condition is checked at the end of each loop, so the contents of the loop will always be executed at least once; this makes it useful for things like input validation.
</p>
<p>
Like in the If instruction, the condition must give a true/false value.
</p>
<h4>While</h4>
<p>
Repeats the instructions inside it until the condition at the top becomes false.<br>
The condition is checked at the beginning of each loop, so it's possible for the loop to not be executed at all if the condition is immediately false.
</p>
<p>
Like in the If instruction, the condition must give a true/false value.
</p>
<h4>For</h4>
<p>
A for loop repeats the instructions inside it like a While loop, but it also handles a variable (usually a counter) automatically, incrementing or decrementing it at the end of each loop.
</p>
<ul>
<li>
<b>Variable</b>: name of the variable to be handled automatically by the loop
</li>
<li>
<b>From</b>: the initial value for the variable. It can be a number or an expression
</li>
<li>
<b>To</b>: the final value for the variable. This tells the for loop when to stop. It can be a number or an expression
</li>
<li>
<b>Direction</b>: the direction of the loop, either increasing or decreasing. If the loop is increasing, then <b>To</b> must be greater than <b>From</b>; if it's decreasing, <b>To</b> must be lower than <b>From</b>
</li>
<li>
<b>Step</b>: how much to increase/decrease the variable at the end of each loop. It can be a number or an expression
</li>
</ul>
<p>
Note: the from-to range is inclusive!
</p>
<h4>Comment</h4>
<p>
Comments have no effect on the program, they are useful to store notes or to document how things work.
</p>
<h4>Breakpoint</h4>
<p>
Automatically pauses execution of the program. Useful for debugging.
</p>
<a name="expressions"></a>
<h2>Expressions</h2>
<p>
Expressions can be used to write mathematical expressions, conditions and conditions.
</p>
<p>
Expressions can contain a mix of variables, values, operators and functions.<br>
Variable names and numeric values can be written directly (for instance, <code>a+1</code>), strings must use quotes or double quotes (for instance, <code>'The price is: '+price</code>), functions use parenthesis and commas to delimit their parameters (for instance, <code>toFixed(price,2)</code>).
</p>
<p>
Expressions are evaluated in this order:
<ul>
<li>Functions</li>
<li>Mathematical operators</li>
<li>Comparison operators</li>
<li>Logical operators</li>
</ul>
</p>
<p>
The following tables list all the operators included in Flogo in order of precedence. Round parenthesis can be used to alter the order of evaluation of the expression (for instance, <code>n/(a+1)</code>); parenthesis can also be nested.
</p>
<a name="operators1"></a>
<h3>Mathematical operators</h3>
<table>
<thead>
<tr>
<th>Operator</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>a ^ b</td>
<td>Power</td>
</tr>
<tr>
<td>a * b</td>
<td>Multiplication</td>
</tr>
<tr>
<td>a / b</td>
<td>Division (real)</td>
</tr>
<tr>
<td>a % b</td>
<td>Modulus (remainder of integer division)</td>
</tr>
<tr>
<td>a + b</td>
<td>Addition (if both operands are numbers)</td>
</tr>
<tr>
<td>a + b</td>
<td>String concatenation (if at least one of the operands is a string)</td>
</tr>
<tr>
<td>a - b</td>
<td>Subtraction</td>
</tr>
</tbody>
</table>
<a name="operators2"></a>
<h3>Comparison operators</h3>
<p>
Comparison operators can be used in conditions to compare a value to another. For instance, <code>a==0</code> is true if the variable <code>a</code> has a value of <code>0</code>.
</p>
<table>
<thead>
<tr>
<th>Operator</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>a < b</td>
<td>Lower than</td>
</tr>
<tr>
<td>a > b</td>
<td>Greater than</td>
</tr>
<tr>
<td>a <= b</td>
<td>Lower or equal</td>
</tr>
<tr>
<td>a >= b</td>
<td>Greater or equal</td>
</tr>
<tr>
<td>a == b</td>
<td>Equals</td>
</tr>
<tr>
<td>a != b</td>
<td>Different</td>
</tr>
</tbody>
</table>
<a name="operators3"></a>
<h3>Logical operators</h3>
<p>
Logical operators allow you to "chain together" multiple conditions. For instance, <code>a<0||a>10</code> is true if the variable <code>a</code> is not between <code>0</code> and <code>10</code>.
</p>
<table>
<thead>
<tr>
<th>Operator</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>! expr</td>
<td>Not<br>Inverts the value of the expression</td>
</tr>
<tr>
<td>a && b</td>
<td>And<br>All expressions must be true for the entire condition to be true</td>
</tr>
<tr>
<td>a || b</td>
<td>Or<br>At least one expression must be true for the entire condition to be true</td>
</tr>
</tbody>
</table>
<a name="functions"></a>
<h3>Built-in functions</h3>
<p>
Flogo has a lot of built-in functions that make writing expressions easier. For instance, <code>round(a)</code> will give you the value of the variable <code>a</code> rounded mathematically to the nearest integer.
</p>
<h4>Mathematics</h4>
<table>
<thead>
<tr>
<th>Function</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>abs(n)</td>
<td>Absolute value</td>
</tr>
<tr>
<td>sqrt(n)</td>
<td>Square root</td>
</tr>
<tr>
<td>sin(n)</td>
<td>Sine (n is an angle in radians)</td>
</tr>
<tr>
<td>cos(n)</td>
<td>Cosine (n is an angle in radians)</td>
</tr>
<tr>
<td>tan(n)</td>
<td>Tangent (n is an angle in radians)</td>
</tr>
<tr>
<td>asin(n)</td>
<td>Arcsine</td>
</tr>
<tr>
<td>acos(n)</td>
<td>Arcosine</td>
</tr>
<tr>
<td>atan(n)</td>
<td>Arctangent</td>
</tr>
<tr>
<td>ln(n)</td>
<td>Natural logarithm (base E)</td>
</tr>
<tr>
<td>log(base,val)</td>
<td>Logarithm</td>
</tr>
<tr>
<td>ceil(n)</td>
<td>Round up to nearest integer</td>
</tr>
<tr>
<td>floor(n)</td>
<td>Round down to nearest integer</td>
</tr>
<tr>
<td>round(n)</td>
<td>Mathematical rounding</td>
</tr>
<tr>
<td>random()</td>
<td>Random real number between 0 and 1</td>
</tr>
</tbody>
</table>
<h4>Strings</h4>
<table>
<thead>
<tr>
<th>Function</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>toFixed(n,d)</td>
<td>Converts a number into a string with d decimal digits</td>
</tr>
<tr>
<td>len(s)</td>
<td>Length of a string</td>
</tr>
<tr>
<td>end(s)</td>
<td>Position of the last character of a string (same as <code>len(s)-1</code>, useful in for loops)</td>
</tr>
<tr>
<td>charAt(s,i)</td>
<td>Returns the character in position i in the string s.<br>The first character in a string has position 0</td>
</tr>
<tr>
<td>charToCode(c)</td>
<td>Converts a character into the corresponding ASCII code (integer)</td>
</tr>
<tr>
<td>codeToChar(n)</td>
<td>Converts an ASCII code into the corresponding character</td>
</tr>
<tr>
<td>strToReal(s)</td>
<td>Converts a string into a real number</td>
</tr>
<tr>
<td>strToInt(s)</td>
<td>Converts a string into an integer number</td>
</tr>
</tbody>
</table>
<h4>Arrays</h4>
<table>
<thead>
<tr>
<th>Function</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>len(s)</td>
<td>Length of an array</td>
</tr>
<tr>
<td>end(s)</td>
<td>Position of the last cell of an array (same as <code>len(s)-1</code>, useful in for loops)</td>
</tr>
</tbody>
</table>
<a name="constants"></a>
<h3>Built-in constants</h3>
<table>
<thead>
<tr>
<th>Constant</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>PI</td>
<td>3.141592653589793</td>
</tr>
<tr>
<td>E</td>
<td>2.718281828459045</td>
</tr>
<tr>
<td>CURRENT_DAY</td>
<td>Current day of month</td>
</tr>
<tr>
<td>CURRENT_MONTH</td>
<td>Current month (1=January, 12=December)</td>
</tr>
<tr>
<td>CURRENT_YEAR</td>
<td>Current year</td>
</tr>
<tr>
<td>CURRENT_HOURS</td>
<td>Current hours (24h format)</td>
</tr>
<tr>
<td>CURRENT_MINUTES</td>
<td>Current minutes</td>
</tr>
<tr>
<td>CURRENT_SECONDS</td>
<td>Current seconds</td>
</tr>
</tbody>
</table>
<a name="arrays"></a>
<h2>Arrays</h2>
<p>
Arrays are a special type of variable that allows you to store more than one value.
</p>
<p>
The way they work is very simple: to create an array, make a variable and set the type to Array, then choose one of the 4 data types: Integer, Real, String or Boolean, and give it a size, that's how many values the array can store.
</p>
<p>
Arrays can be used like normal variables; for instance, if you declare an array <code>a</code> of type Integer and size 100, that would be like declaring 100 integer variables named from <code>a[0]</code> to <code>a[99]</code>. All these variables (called cells or items of the array) are not initialized when the program starts. The number between the square brackets is called <b>index</b>, and it indicates which cell of the array you're trying to use.
</p>
If you try to access an index that's outside the bounds of the array, such as <code>a[100]</code>, or if you try to read from an uninitialized cell, your program will crash; remember that indices go from 0 to the size-1, and that you cannot use uninitialized variables in expressions.
</p>
<p>
You can also use an expression as an index when using an array. For instance, let's say that you want to read 10 numbers and store them for later, if you do that by declaring 10 variables, you'd need 10 input instructions; but with arrays you can use loops, so you can just write a loop for i=0 to 9 and input <code>a[i]</code> at each step.<br>This makes arrays extremely powerful and versatile.
</p>
<p>
Arrays cannot be used directly in expressions and assignments, only their individual cells can. For instance, if you have an array <code>a</code> and you try to output <code>a</code> directly will crash your program; if you want to print the contents of the array, you need to use a loop.
</p>
<p>
While your program is running, you can see the contents of your arrays in real time by expanding them in the variables list.
</p>
<h4>Variable array size</h4>
<p>
Sometimes you don't know how big your array needs to be when you're writing your program. Arrays in Flogo are static, meaning that they cannot change size while the program is running, but nothing stops you from declaring a large enough array and storing the size separately in an integer variable, that way the size can change at any time without actually resizing the array. We call that variable <b>logical size</b>. Keep in mind that the <code>end</code> and <code>len</code> functions will still give you the full size of the array, not the logical size!
</p>
<a name="turtle"></a>
<h2>Graphics</h2>
<p>
The basic concept behind Turtle Graphics is that you're controlling a cursor (called "turtle", but his real name is Augustino). When the program is started, the turtle is at the center of the drawing area and it's pointing up (this is its "home"), and you can use instructions to move it, draw a line while moving, turn it left or right and it can also instantly move back to its home.
</p>
<h4>Move/Draw</h4>
<p>
A Move/Draw instruction moves the turtle by the specified distance in the direction that it's currently pointing at. It can draw a line behind it while moving.
</p>
<ul>
<li><b>Expression</b>: how much you want to move. It can be a simple number or a mathematical expression using your variables</li>
<li><b>Draw</b>: if enabled, it draws a line while moving, otherwise the turtle will just move without drawing anything</li>
</ul>
<h4>Turn</h4>
<p>
A Move/Draw instruction changes the angle that the turtle is currently pointing at by a specified amount of degrees.
</p>
<ul>
<li><b>Expression</b>: how many degrees much you want the turtle to turn by. It can be a simple number or a mathematical expression using your variables</li>
<li><b>Direction</b>: whether to turn the turtle left or right</li>
</ul>
<h4>Home</h4>
<p>
Instantly moves the turtle back to the starting position (its "home"), pointing upwards. It does not draw a line while moving.
</p>
</div>
<button id="man_close"><span class="icon material-icons-sharp">close</span></button>
</div>
<div id="licenseViewer" class="popup noAutoClose">
<iframe src="LICENSE.txt" id="license"></iframe>
<button id="license_close"><span class="icon material-icons-sharp">close</span></button>
</div>
<script type="module" src="/src/app.js"></script>
</body>
</html>