# scheme if else – If..else, Nested If..else and else..if Statement with example

scheme if else Statements : In this article we introduce Scheme’s conditional expressions. The if-then and if-then-else Statements. If x = 4 and y=5. which of these statements are true? Which are false? Compound Conditions.

scheme if else : Scheme control structures are expressions, and return values.

## scheme if else statements with Example

Contents

First of all, it define a variable d_no and assign 11 to it.

Checks if d_no is less than 10, in which case is false, therefor it skip d_no, and go to the next argument which is another if statement.

Also Read This ðŸ‘‰   Send email using nodejs and express in Nodemailer steps

The second if checks if the d_no is greater than 20, d_no is not, therefor it skip the first argument d_no as well as proceed to the second argument which is expression to multiply d_no by 2, as well as the output of the multiplication is the output of this “scheme if else” program.

It prints 22 since 11 times 2 is 22.

### scheme if else statements

```(define d_no 11)
(if (< d_no 10)
d_no
(if (> d_no 20)
d_no
(* d_no 2)
)
)

```

Results: scheme if else

```;Loading "ifelse.scm"... done
;Value: 22
```

Don’t Miss : Laravel If Else and Switch Case.

Also Read This ðŸ‘‰   jQuery trigger function viewport Example

## Scheme Programming/Conditionals

Truth values in Scheme

```> (not #t)
#f
> (not #f)
#t
```

and and or

```> (and #t #f)
#f
> (or #f (not #f))
#t
> (and (> 3 2) #t)
#t
> (or (<= 3 2) (zero? (- 10 3)))
#f
```

Simple Conditionals: if

```> (if #t 1 0)
1
> (if (>= 5 8) 3 (+ 7 2))
9
```

More Details : Scheme – Expressions

### How does `if` statement work in Scheme?

It’s Uses to “Applicative programming language”.

An Introduction to Scheme and its Implementation

I hope you get an idea about scheme if else.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, donâ€™t forget to share.