Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scala: Code only run when debugging(#ifdef equivalent?)

In C++ I can write:

#ifdef DEBUG
cout << "Debugging!" << endl;

Is there any equivalent in Scala?

like image 830
Lai Yu-Hsuan Avatar asked May 29 '13 16:05

Lai Yu-Hsuan


1 Answers

The conventional idiom is @elidable.

The scaladoc covers your conventional use case:

http://www.scala-lang.org/api/current/scala/annotation/elidable.html

like image 153
som-snytt Avatar answered Sep 28 '22 09:09

som-snytt