Skip to content

4. Conditions ​

Stated conditions are ordered computations. and stops at the first false child; inclusive or stops at the first true child. Skipped children do not execute or consume semantic steps, but the compiler still parses, resolves, type-checks, and backend-checks the whole tree.

Complete program ​

txt
Define filter-by-two-thresholds as a function.
It accepts an integer sequence named input, an integer named threshold, and another integer named other-threshold.
Collect the input values in encounter order into a fresh sequence. Retain each value only when it is greater than the threshold and it is greater than the other-threshold.
go
package generated

func FilterByTwoThresholds(p0 []int64, p1 int64, p2 int64) ([]int64, error) {
	result := make([]int64, 0)
	for _, value := range p0 {
		if value > p1 && value > p2 {
			result = append(result, value)
		}
	}
	return result, nil
}

The generated conjunction keeps a value only when both comparisons are true. Equality fails the strict greater-than condition.

Two-item forms use A and B or A or B. Three-item forms may use A, B and C or A, B, and C, with it required by retention-condition grammar. The maintained three-condition regression source is the executable specimen. Mixed connectors are rejected because the language has no Boolean grouping syntax or connector precedence. A comma list requires a final connector in documented syntax; see Known parser issue.

Exercise ​

Change lower to 8 and upper to 7. Which branch runs and what is the result?

Verified solution

The comparison is true, so the If branch runs. No input value is greater than 8, so the result is [].

← Selecting and transforming · Counting, summing, and distinct collection →

Stated compiles controlled English deterministically. It does not call an LLM at compile time.