# Add one more example to hexrays plugins

**URL:** https://community.hex-rays.com/t/add-one-more-example-to-hexrays-plugins/188
**Category:** IDA General
**Created:** [February 26, 2025, 6:00pm UTC](https://community.hex-rays.com/t/add-one-more-example-to-hexrays-plugins/188 "2025-02-26T18:00:32Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![revs](https://avatars.discourse-cdn.com/v4/letter/r/dc4da7/32.png) [@revs](https://community.hex-rays.com/u/revs)
#### Post date: [February 26, 2025, 6:00pm UTC](https://community.hex-rays.com/t/add-one-more-example-to-hexrays-plugins/188/1 "2025-02-26T18:00:32Z")

</div>

could you add one more plugin to the examples  
that could complement the existing one invert-if-else (plugins\vds3\hexrays\_sample3.cpp)  
thereby solving the long-standing if-else problem

an example of a plugin that would create an if else block from an if block  
and vice versa, break the if-else and make a regular if block

---

<div class="post-metadata">

### Author: ![igor](https://sea2.discourse-cdn.com/flex002/user_avatar/community.hex-rays.com/igor/32/35_2.png) [@igor](https://community.hex-rays.com/u/igor)
#### Post date: [February 27, 2025, 3:41pm UTC](https://community.hex-rays.com/t/add-one-more-example-to-hexrays-plugins/188/2 "2025-02-27T15:41:09Z")

</div>

I’m not quite sure I understand the description, could you add some concrete examples?

---

<div class="post-metadata">

### Author: ![revs](https://avatars.discourse-cdn.com/v4/letter/r/dc4da7/32.png) [@revs](https://community.hex-rays.com/u/revs)
#### Post date: [February 27, 2025, 3:49pm UTC](https://community.hex-rays.com/t/add-one-more-example-to-hexrays-plugins/188/3 "2025-02-27T15:49:11Z")

</div>

```auto
if (condition)
{
  block1
}

block 2

```

convert to

```auto
if (condition)
{
  block1
} else
{
  block 2
}

```

after this i will invert by invert-if-else (plugins\vds3\hexrays\_sample3.cpp)  
and do vise versa

```auto
if (!condition)
{
  block2
} else
{
  block 1
}

```

convert to

```auto
if (!condition)
{
  block2
}

block 1

```

---

<div class="post-metadata">

### Author: ![igor](https://sea2.discourse-cdn.com/flex002/user_avatar/community.hex-rays.com/igor/32/35_2.png) [@igor](https://community.hex-rays.com/u/igor)
#### Post date: [March 13, 2025, 12:03pm UTC](https://community.hex-rays.com/t/add-one-more-example-to-hexrays-plugins/188/4 "2025-03-13T12:03:51Z")

</div>

Hm, It seems your suggested transformations are not valid.  
E.g. first example executes block1; block2 if condition is true but transformed one executes only block1.

---

<div class="post-metadata">

### Author: ![revs](https://avatars.discourse-cdn.com/v4/letter/r/dc4da7/32.png) [@revs](https://community.hex-rays.com/u/revs)
#### Post date: [March 13, 2025, 12:16pm UTC](https://community.hex-rays.com/t/add-one-more-example-to-hexrays-plugins/188/5 "2025-03-13T12:16:36Z")

</div>

“return;” are present  
i just skip it for simplify idea  
convert “if else” to “if” and vise versa
