!ifdef A || B

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

1 Answer

0 votes
answered Nov 22, 2016 by Serge Wenger Work (5,480 points)

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
commented Nov 22, 2016 by boshka (1,320 points)
many thanks!
commented Nov 22, 2016 by plantuml (134,570 points)
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,
commented Nov 22, 2016 by boshka (1,320 points)
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.
...