In Ruby, if-else statements are straightforward and follow a clean syntax. Here is how we can write them: Syntax: if condition # Code to execute…