Conditions in Vitte

This page treats Vitte logic as an executable mechanism: each rule is linked to a concrete consequence in the program flow. A Vitte condition is a semantic circuit breaker. It must delineate a case, not simply change path visually.

proc safe_div(num: int, den: int) -> int {
  if den == 0 { give 0 }
  give num / den
}

Why this step is solid. The protected condition removes an invalid state before the sensitive operation. In Vitte, this style is preferred to late implicit management because it sets the boundary at the exact point of risk.

What happens at runtime. safe_div(12,3) follows the nominal branch and returns 4. safe_div(12,0) takes guard, skips the division and returns 0.

proc classify(temp: int) -> int {
  if temp < 0 { give -1 }
  if temp > 100 { give 2 }
  give 1
}

Why this step is solid. This sequential guard pattern limits nesting and makes each input class directly testable. The first condition removes the low subdomain, the second removes the high subdomain, the rest is nominal.

What happens at runtime. classify(-2)=-1, classify(50)=1, classify(120)=2.

proc can_start(ready: bool, valid: bool, blocked: bool) -> int {
  if ready and valid and not blocked { give 1 }
  give 0
}

Why this step is solid. Condition composed in short-circuited conjunction. The predicate is evaluated from left to right and can stop as soon as a term is false.

What happens at runtime. (true,true,false)->1, (true,false,false)->0, (true,true,true)->0.

This page relates to the mechanisms of if, and, or, not and otherwise, details in book/chapters/keywords/if.html, book/chapters/keywords/and.html, book/chapters/keywords/or.html, book/chapters/keywords/not.html and book/chapters/keywords/otherwise.html.