0

How to ignore unreachable statement in Java/Android studio purposely.

This is just for testing, for example, I have a lot of codes below it, and I just want to do return above the codes for testing purpose.

Currently it gives error in Android Studio and I can't run it.

An alternative would be to comment the codes below, but I do this a lot, and it's a little cumbersome.

Thanks.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Mustofa
  • 1
  • 1
  • You can comment/uncomment multiple lines in Android studio at once, why not do that? – Kevin Jun 20 '17 at 05:11
  • @Kevin, I wrote that in my question above. I do this a lot, just for testing some parts, and it's a little time wasting to comment and uncomment lines. In XCode, it just simply gives you a warning. – Mustofa Jun 20 '17 at 05:17
  • I do this sometimes as well but writing return vs highlighting the rest of the lines in a method and pressing Ctrl + / is about the same for me – Kevin Jun 20 '17 at 05:22
  • Yep, it's a duplicate question, but the answer there don't satisfy me. But I found the real answer in one of the comments there, which is : `if (true) return;` – Mustofa Jun 20 '17 at 10:07

0 Answers0