Skip to main content

If Else

In Crabby, using if & else statements are a way to make decisions in your code. It's a simple and straightforward way to control the flow of your program based on certain conditions.

Here's an example of an if statement in Crabby:

let x = true
let y = false

if x { // If choose 'y', then it'll return it false
print("True!")
} else {
print("False!")
}

In this example, we have two variables x and y. We use the if statement to check if x is true or false. If x is true, then the program will print "True!".