mirror of
https://github.com/artegoser/ONLang
synced 2024-11-05 12:33:58 +03:00
doc: timer example
This commit is contained in:
parent
3f20238d9c
commit
fcf90eff0a
1 changed files with 28 additions and 0 deletions
28
examples/timer.onla
Normal file
28
examples/timer.onla
Normal file
|
@ -0,0 +1,28 @@
|
|||
[
|
||||
{
|
||||
let: {
|
||||
seconds: { toNumber: { input: "Enter the seconds to count down: " } },
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
loop: [
|
||||
{
|
||||
if: {
|
||||
condition: { comp: [{ var: "seconds" }, "<=", 0] },
|
||||
body: ["break"],
|
||||
},
|
||||
},
|
||||
[{ var: "seconds" }, " seconds left"],
|
||||
{
|
||||
assign: {
|
||||
seconds: { calc: [{ var: "seconds" }, "-", 1] },
|
||||
},
|
||||
},
|
||||
{ sleep: 1000 },
|
||||
"clear",
|
||||
],
|
||||
},
|
||||
|
||||
["Time's up"],
|
||||
]
|
Loading…
Reference in a new issue