# EDP syntax - if ( ) statements

**URL:** https://community.freefem.org/t/edp-syntax-if-statements/2266
**Category:** General Discussion
**Created:** [February 6, 2023, 6:29pm UTC](https://community.freefem.org/t/edp-syntax-if-statements/2266 "2023-02-06T18:29:29Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ceb](https://avatars.discourse-cdn.com/v4/letter/c/ecc23a/32.png) [@ceb](https://community.freefem.org/u/ceb)
#### Post date: [February 6, 2023, 6:29pm UTC](https://community.freefem.org/t/edp-syntax-if-statements/2266/1 "2023-02-06T18:29:29Z")

</div>

Thank you so much to everyone who codes/maintains this amazing software!  
I saw one-liner if ( ) statements in a few EDP file examples, and when I tried to use more statements between curly braces { } following the if ( ) I run into some issues.  
I read the documentation and I could not find a description of if (), I found “for” and “while”, but not “if”, and the key index at the end of the documentation does not list the if statement.  
I could just work with for or while () using an extra variable to make it finish after one iteration, but I though perhaps you want to put some info in the documentation, and if you have something handy, I would be very thankful if you share it with me.

Thanks again to everyone who develops/maintains FreeFEM++ !!!

---

<div class="post-metadata">

### Author: ![cmd](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/cmd/32/67_2.png) [@cmd](https://community.freefem.org/u/cmd)
#### Post date: [February 6, 2023, 6:47pm UTC](https://community.freefem.org/t/edp-syntax-if-statements/2266/2 "2023-02-06T18:47:36Z")

</div>

Could you give an example of your syntax and your issues?

```auto
real one, two, four;
#In-line if statement, applies to next operation
if ( condition) one = 1.0; // ends if statement
else if (alternatecondition) { //scoped if statement, applies to everything in braces
    two = 2.0;
    real three = 3.0; // this isnt stored outside of the {}
} else {
    four = 4;
}

```

---

<div class="post-metadata">

### Author: ![ceb](https://avatars.discourse-cdn.com/v4/letter/c/ecc23a/32.png) [@ceb](https://community.freefem.org/u/ceb)
#### Post date: [February 6, 2023, 8:55pm UTC](https://community.freefem.org/t/edp-syntax-if-statements/2266/3 "2023-02-06T20:55:43Z")

</div>

Chris, Thanks a lot for these examples.  
The error that I was getting was not because of the “if” statement, but because I was trying to reassign the value of a “func” object, the compiler error was not obvious for me, so I thought it was related to the if().  
Everything is good, thanks again for your help !
