#!ek9
<?-
{
  "site": {
    "pages": [
      "flowControl.html"
    ],
    "title": "For loops over Float and Time ranges",
    "kind": "good"
  },
  "keywords": [
    "for",
    "range",
    "Float",
    "Time",
    "Duration"
  ],
  "primaryTopics": [
    "flowControl"
  ]
}
-?>
defines module site.flowControl.forfloattime

  defines function

    FloatForLoop()
      stdout <- Stdout()

      //So you could do a calculation to get this value
      incrementer <- 6.3
      for i in 8.2 ... 30.0 by incrementer
        stdout.println(`Value [${i}]`)

      //descending
      for i in 90.0 ... 70.0 by -5.0
        stdout.println(`Value [${i}]`)

    TimeForLoop()
      stdout <- Stdout()

      //From 9-5:30 every half hour
      start <- Time().startOfDay() + PT9H
      end <- Time().endOfDay() - PT6H30M
      thirtyMinutes <- PT30M

      //Be aware that time loops around.
      for i in start ... end by thirtyMinutes
        stdout.println(`Value [${i}]`)
//EOF
