Home
Documentation
Basic rules
Flashlight is called an interpreted programming language because it goes through an interpreter. It goes operation by operation. A flashlight command consists of the function sign, braces - and arguments inside of them, with semicolon at the end. Flashlight Interpreter will ignore every space, tab and new line character.
Flashlight comments:
#** one line comment **# P{s{Text}}; #** multi line comment **#
Flashlight commands:
- P{val} Prints values separated by comma.
Example:
P{ s{Text},i{45},f{3.14} }; P{s{Another},A{i{32}},s{text}}; P{s{JustOne}};
Example:
P{ s{text} };
Example:
P{ i{5}, i{f{9.9}}, +{i{2},i{U{s{Input=}}}} };
Example:
P{ f{5}, f{9.9}, +{f{2},f{U{s{Input=}}}} };
Example:
P{ +{i{2},f{3.14},i{100}} };
R = val1-val2-val3-val3...
Example:
P{ -{i{200},i{3},i{100}} #** returns 97 **# };
Example:
P{ *{i{3},i{3}} #** returns 9 **# };
R = val1/val2/val3/val3...
Example:
P{ /{i{9},i{3}} #** returns 3.0 **# };
Example:
P{ %{i{9},i{2}} #** returns 1 **# };
Example:
P{ s{Text1},A{i{32}},s{Text2} };
Example:
P{ O{s{x}} };
Example:
S{ s{counter},i{0} };
Example:
P{ R{s{counter}} };
Example:
P{ ?{ C{s{=},i{4},+{i{2},i{2}}}, s{2+2=4}, s{2+2<>4} } };
Example:
P{ C{s{>},i{1},i{5}} #** returns False **# };
Example:
P{ &{i{1},i{5},i{0}} #** returns False **# };
Example:
P{ |{i{1},i{5},i{0}} #** returns True **# };
Example:
S{ .{s{arr},R{s{counter}}}, i{0} };
Example:
S{ s{customFunction}, s{ S{ s{counter} , +{R{s{counter}}, i{1}} }; P{ R{s{counter}} }; } }; F{R{s{customFunction}}};
Example:
S{ s{counter},i{5} }; W{ R{s{counter}}, F{s{ P{ _{ s{_} , A{i{32}} , s{Counter_is_greater_than_0} }, A{i{10}} }; S{s{counter},-{R{s{counter}},i{1}}}; }} };
Example:
S{ s{x}, i{U{s{x=}}} }; P{ s{5+x=}, +{i{5},R{s{x}}}};
Example:
P{r{i{100}}};
Example:
P{r{i{1},i{10}}};
Example:
P{ L{s{Text}} #** returns 4 **# };
Example:
P{ G{s{Text},i{2}} #** returns 'x' **# };
Example:
P{ _{s{l},s{X},s{Hello}} #** returns 'HeXXo' **# };
Example:
P{ @{s{upper},s{Hello}} #** returns 'HELLO' **# };
Returns True if string val2 contains string val1 otherwise returns False.
Example:
P{ @{s{in},s{ll},s{Hello}} #** returns True **# };
Returns text as string from file val
Example:
P{ #{s{r},s{file.txt}} };
Writes text from val2 to file val1
Returns True if text was saved to file otherwise returns False. Example:
P{ #{s{w},s{hello.txt},s{Hello}} };