# Error of the If command in the input bar

jospercomp shared this question 3 years ago I found an error of the if command when entering two domain restriction conditions for multivariable functions. I do not understand why if I put the command from the input bar it does not work and it produces an error message. But if I first enter the function without conditions in the input bar and then change it from the properties window the command does not give errors. If I place if nested in the input bar if they work.

If(x > 0, If(0 < y < 1, 5ℯ^(-3π² x) sin(π y)))

If(0 < y < 1, If(x > 0, 5ℯ^(-3π² x) sin(π y)))

The nested if graphs are not the same as the if graph with the conditions separately. In addition, the commands using and and or generate other graphics with restrictions.

If(x > 1 ∧ 0 < y < 1, 5ℯ^(-3π² x) sin(π y))

If(x > 1 ∨ 0 < y < 1, 5ℯ^(-3π² x) sin(π y)) 1

https://wiki.geogebra.org/e... 1

The manual says nothing when the syntax of the if command is:If( <Condition 1>, <Condition 2>, <Then> )

I do not understand why this syntax works in Value Inputbox; but it is not working in Input bar. 1

```this syntax works in Value Inputbox
``` 1

Input bar write:

5ℯ^(-3π² x) sin(π y)

In Value Textbox rewrite:If(x > 0, 0 < y < 1, 5ℯ^(-3π² x) sin(π y)) 1 1

This is ggb file. 2

You can combine conditions like this:

```b(x, y) = If(x > 0 ∧ y > 0 ∧ y < 2, 5ℯ^(-3π² x) sin(π y))
```

This one works but you need to zoom in a little:

```b(x, y) = If(x > 0 ∧ y > 0 ∧ y < 1, 5ℯ^(-3π² x) sin(π y))
```

Your file is using the syntax

```If( <Condition>, <Then>, <Else> )
```

but not working as <Then> and <Else> are different object types  1

I think this:

if(x>0,0<y<1,f) is read like if(x>0, function 1 when 0<y<1 otherwise 0,other wise f)

the second condition is interpreted as function defined with a boolean (0 or 1) value

see the plane zone at 1 high in your second image 1

How can I write this syntax as a Geogebra command?

if(x>0, function 1 when 0<y<1 otherwise 0,other wise f) 2

just like you have tried,ie:

a(x,y)=x^2+y^2

f(x, y) = If(x > 0, 0 < y < 3, a(x, y))

hide a

I used 3 because is more visible 1  