Don't use do-while loop in Payment system - Said lecturer

But I don't think do When I was studying in university @Level2 I acquired some logics behind Loops when we were learning OOP in Java. Our lecturer warned us and said 'Never use do-while loop just because it performs whatever while-loop can do. What if you want to make a condition to give money to someone? - with do-while loop tech, The system will give money to client then check his pin or password after - then he went on... saying this 'Do you think do-while-loop is good at that job? Most of us, said - We will use while-loop forever. What do you think about this devs, Tell us what do you think about this statement! Happy coding!

»Programming @gadrawin

» 1 answer  » 193 views   

Add photos

Codeveloper • 1 year ago
I think do-while-loop is not always bad, but depending on what you want to perform before and after given condition. As far as I can understand what you meant your you mean something like this.

// Here action will be performed first 
// and then condition checked after.
// As do-while-loop works. 

do {
System.out.println("Money withdrawn successfully");
} while (Balance >= RequestedMoney);


0  Dislike  •  Reply

Back to top

[SHARE THIS POST]: The post's archived Spread it to others!

Posted under this donnektish »
This group(donnektish) is about sharing interesting stuffs, topics, questions and answers related to Programming
85 people joined this donnektish

Maintain social distancing, to avoid Covid19