if else i prefer. Multiple ifs sounds like a political programming and you are not sure what you are doing.
22 Nisan 2016 Cuma tarihinde, Leon Rosenberg <rosenberg.l...@gmail.com> yazdı: > Hi guys, > > this is completely off-topic ;-) > > I was wondering if using if/else is not actually slowing down your code. > Lets say I have three possible conditions, A, B and C, which are exclusive. > My native approach would be: > if (A){...} > if (B){...} > if (C){...} > > now some people would 'optimize' it as > if (A){ ...} else if (B) {....} else if (C) { ....} > and I think in the world of single-cpu computers this optimization could > work. > > But what is now, given that compilers can optimize stuff like this and tell > the processor to calculate all 3 branches simultaneously, which is not > possible for ifelse. > > Which one would you choose? > Equally important, which one do you think is more readable? I would say if > else is hard to read, but this can be just personal impression. > > regards > Leon >