> ## Documentation Index
> Fetch the complete documentation index at: https://docs.standardcomputers.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Conditional Logic and Boolean Operators in Standard

> Write if, if-else, and else-if conditions in Standard code using boolean logic, comparison operators, and boolean conjunction operators.

Standard uses boolean logic to control the flow of your programs. Every condition you write evaluates to either `true` or `false`, and code inside a conditional block only executes when that evaluation returns `true`. You can compare values using all standard comparison operators:

```text theme={null}
price 5
print (price == 5) #Prints true
print (price = 5)  #Prints true
print (price < 5)  #Prints false
print (price > 5)  #Prints false
print (price >= 5) #Prints true
```

## If-Equals Shorthand

Because Standard does not use `=` to assign values to variables, you can omit `=` entirely when checking value equality inside a condition. This shorthand makes equality checks more concise.

<Note>
  This shorthand is for comparing values. When you use `==`, Standard compares memory addresses rather than values — so two variables holding the same number can return `false` with `==` if they are stored at different addresses.
</Note>

```text theme={null}
print (p 5)  #Prints true
print (p 7)  #Prints false

f1 7
f2 7

print (f1 f2)    #Prints true, uses equals-short-hand
print (f1 == f2) #Prints false, values at different addresses
```

## If Conditions

A simple `if` condition uses the syntax `if: ARGS { ... }`:

```text theme={null}
if: 7 > 5 {
    print "Duh!"
}
```

## If-Else

To handle an alternative condition, chain an `else:` clause with its own arguments and block:

```text theme={null}
in number

if: number > 5 {
     print "Nice, more than 5 is great!"
} else: number < 0 {
     print "Number should be more than 0!"
}
```

## Shorthand If-Else

When your `else` branch has no condition of its own, you can omit the `else` keyword and attach the fallback block directly with `:{`:

```text theme={null}
if: 5 < 7 {
    print "5 is less than 7! YAY!"
}:{
    print "Your computer can't do math!"
}
```

## Boolean Operators

Build more complex conditions by combining boolean expressions with `and`, `or`, `&`, `&&`, `|`, or `||`:

```text theme={null}
in username "Username: "
in psswd "Password: "

if: username "" and psswd "" {
    print "Welcome in!"
}:{
    print "Denied"
}
```

## Negation

Prepend a boolean value or variable with `!` to negate it:

```text theme={null}
bool true
print !bool #Prints false
```
