Welcome to PlantUML Q&A, where you can ask questions and receive answers from other members of the community.

You can also submit new features request and vote for them.

!ifdef A || B

0 votes
is it possible to use OR condition in the !ifdef preprocessor command?
asked Nov 21, 2016 in Wanted features by boshka (990 points)

1 Answer

0 votes

Hello,

Your proposal is interesting. I do this with a workaround:

@startuml
'define A
!define B
!ifdef A
!define AorB
!else
!ifdef B
!define AorB
!endif
!endif
!ifdef AorB
title A or B
!endif
Bob-> Alice
@enduml
 
 
Hope this helps
answered Nov 22, 2016 by Serge Wenger Work (4,350 points)
many thanks!
Very clever workaround!

However, I think we need a better solution.
So in last beta https://dl.dropboxusercontent.com/u/13064071/plantuml.jar

You can have things like:
!ifdef A || B
!ifdef A && B
!ifdef A && ( B || !C )

You can also use | & instead of || && (same meanings).

This has not been highly tested, so do not hesitate to do feedback.

Regards,
Indeed a nice workaround. I used it since I must provide a backwards compatible solution. But anyway, many thanks for adding the new format too.
Support This Project Offer 250 Mo! Follow PlantUML on Twitter
...