I have currently hard-coded in some data for a demo of a project. The code looks like this:
update: () =>
t = getTime()
if t == undefined
zone = -1
else if between(t, 100, 110)
zone = 1
else if between(t, 111, 120)
zone = 2
Now, the next step is to take a json array of the form:
[{"start": 100, "end": 110, "zone": 1}, {"start": 111, "end": 120,"zone": 2}]
to make the generated code above. Is this possible? What is the best way to go about doing this?
1 Answer