# Conditions and loops

`if` runs a block when its condition is true; `else if` and `else` cover the other cases. Combine
conditions with `and`, `or` and `not`. The short form `a if (condition) else b` picks a value.

```vi
main grades():
  for score in [95, 82, 64]:
    if (score >= 90):
      print(score, "is an A")
    else if (score >= 80):
      print(score, "is a B")
    else:
      print(score, "needs work")
  n = 0
  while (n < 3):
    n = n + 1
  print("counted to", n)
  late = false
  print("on time" if (not late) else "late")
```

The short form works in attributes too: `color: green if (done) else gray`.
