Jump to content

Need help figuring out do loop in java

SuperShermanTanker

Would this help?

https://docs.oracle.com/javase/tutorial/java/nutsandbolts/while.html

 

I am not a Java programmer, but if you can give me a bit more info I could maybe help you out more (or at least point you into the right direction)

"We're all in this together, might as well be friends" Tom, Toonami.

 

mini eLiXiVy: my open source 65% mechanical PCB, a build log, PCB anatomy and discussing open source licenses: https://linustechtips.com/topic/1366493-elixivy-a-65-mechanical-keyboard-build-log-pcb-anatomy-and-how-i-open-sourced-this-project/

 

mini_cardboard: a 4% keyboard build log and how keyboards workhttps://linustechtips.com/topic/1328547-mini_cardboard-a-4-keyboard-build-log-and-how-keyboards-work/

Link to comment
Share on other sites

Link to post
Share on other sites

usually, it works like this:

 

do {
     statement(s)
} while (expression);

 

 

 

GUITAR BUILD LOG FROM SCRATCH OUT OF APPLEWOOD

 

- Ryzen Build -

R5 3600 | MSI X470 Gaming Plus MAX | 16GB CL16 3200MHz Corsair LPX | Dark Rock 4

MSI 2060 Super Gaming X

1TB Intel 660p | 250GB Kingston A2000 | 1TB Seagate Barracuda | 2TB WD Blue

be quiet! Silent Base 601 | be quiet! Straight Power 550W CM

2x Dell UP2516D

 

- First System (Retired) -

Intel Xeon 1231v3 | 16GB Crucial Ballistix Sport Dual Channel | Gigabyte H97 D3H | Gigabyte GTX 970 Gaming G1 | 525 GB Crucial MX 300 | 1 TB + 2 TB Seagate HDD
be quiet! 500W Straight Power E10 CM | be quiet! Silent Base 800 with stock fans | be quiet! Dark Rock Advanced C1 | 2x Dell UP2516D

Reviews: be quiet! Silent Base 800 | MSI GTX 950 OC

 

Link to comment
Share on other sites

Link to post
Share on other sites

@19_blackie_73 is correct. Just remember a do while will always be executed at least once.

CPU: Intel i7 - 5820k @ 4.5GHz, Cooler: Corsair H80i, Motherboard: MSI X99S Gaming 7, RAM: Corsair Vengeance LPX 32GB DDR4 2666MHz CL16,

GPU: ASUS GTX 980 Strix, Case: Corsair 900D, PSU: Corsair AX860i 860W, Keyboard: Logitech G19, Mouse: Corsair M95, Storage: Intel 730 Series 480GB SSD, WD 1.5TB Black

Display: BenQ XL2730Z 2560x1440 144Hz

Link to comment
Share on other sites

Link to post
Share on other sites

Just a little tip: the use of do-while loops is a bad habit, they bring a lot of confusion and problems (mostly off-by-one errors).

They can be used only when reading from a stream.

 

Syntax:

do{
  /* Your code here, executed until
  condition turns into false */
}while(condition);

 

Link to comment
Share on other sites

Link to post
Share on other sites

and one important thing is the ; after the while statement

GUITAR BUILD LOG FROM SCRATCH OUT OF APPLEWOOD

 

- Ryzen Build -

R5 3600 | MSI X470 Gaming Plus MAX | 16GB CL16 3200MHz Corsair LPX | Dark Rock 4

MSI 2060 Super Gaming X

1TB Intel 660p | 250GB Kingston A2000 | 1TB Seagate Barracuda | 2TB WD Blue

be quiet! Silent Base 601 | be quiet! Straight Power 550W CM

2x Dell UP2516D

 

- First System (Retired) -

Intel Xeon 1231v3 | 16GB Crucial Ballistix Sport Dual Channel | Gigabyte H97 D3H | Gigabyte GTX 970 Gaming G1 | 525 GB Crucial MX 300 | 1 TB + 2 TB Seagate HDD
be quiet! 500W Straight Power E10 CM | be quiet! Silent Base 800 with stock fans | be quiet! Dark Rock Advanced C1 | 2x Dell UP2516D

Reviews: be quiet! Silent Base 800 | MSI GTX 950 OC

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×