Boolean Operations

Osprey has no if/else statement. Conditional logic is written as a match on a boolean (which forces both arms to be considered) or as the ternary shorthand cond ? then : else, which desugars to the same match. The ternary is defined in Pattern Matching.

let status = match isValid {
    true  => "Success"
    false => "Failure"
}

let max = match a > b {
    true  => a
    false => b
}

Nested matches handle compound conditions:

let category = match score >= 90 {
    true  => match score == 100 {
        true  => "Perfect"
        false => "Excellent"
    }
    false => match score >= 70 {
        true  => "Good"
        false => "Needs Improvement"
    }
}

Boolean Operators

&&, ||, and ! are short-circuiting; ==, !=, <, >, <=, >= produce booleans. See Lexical Structure for the full operator list.

let isAdult       = age >= 18
let hasPermission = isAdult && isAuthorized
let canAccess     = hasPermission || isAdmin
let isBlocked     = !isActive
let validUser     = !isBanned && (isVerified || hasInvite)