ONLang/examples/timer.onla

29 lines
474 B
Text
Raw Permalink Normal View History

2022-08-29 22:13:33 +03:00
[
{
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"],
]