#!/usr/bin/env bellos # File: control_structures.bellos # Demonstrating if-else statements echo "Demonstrating if-else statements:" x=10 If [ $x -gt 5 ] Then echo "x is greater than 5" Else echo "x is not greater than 5" Fi # Demonstrating nested if-else echo "Demonstrating nested if-else:" y=20 If [ $x -gt 5 ] Then If [ $y -gt 15 ] Then echo "x is greater than 5 and y is greater than 15" Else echo "x is greater than 5 but y is not greater than 15" Fi Else echo "x is not greater than 5" Fi # Demonstrating while loop echo "Demonstrating while loop:" counter=0 While [ $counter -lt 5 ] Do echo "Counter: $counter" counter=$((counter + 1)) Done # Demonstrating for loop echo "Demonstrating for loop:" For i In 1 2 3 4 5 Do echo "Iteration: $i" Done # Demonstrating for loop with command substitution echo "Demonstrating for loop with command substitution:" For i In $(seq 1 5) Do echo "Number: $i" Done # Demonstrating case statement echo "Demonstrating case statement:" fruit="apple" Case $fruit In "apple") echo "It's an apple" ;; "banana") echo "It's a banana" ;; "orange") echo "It's an orange" ;; *) echo "Unknown fruit" ;; Esac # Demonstrating function echo "Demonstrating function:" Function greet ( echo "Hello, $1!" ) greet "World" greet "Bellos" echo "Control structures demonstration completed."