The Artima Developer Community
Sponsored Link

Java Answers Forum
do while

2 replies on 1 page. Most recent reply: Nov 17, 2002 6:16 AM by Dante T. Salvador

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
hyderman

Posts: 11
Nickname: salem99
Registered: Oct, 2002

do while Posted: Nov 16, 2002 9:41 PM
Reply to this message Reply
Advertisement
hi i am trying to change the if statement to
do while or while


public work(int length)
{
if (length > 0)
{
count = 1;
r_length = lenght;
}
else
{
count = 1;
r_length = 4;
}
}

NOW here is my solution:

public work(int length)
{
do
{
count = 1;
r_length = lenght;
}

{
count = 1;
r_length = 4;
}
while (length > 0);
}
is this right can some one help


Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: do while Posted: Nov 17, 2002 12:15 AM
Reply to this message Reply
What are you trying to accomplish in this while statement? It helps a lot when you have a method name (as well as variable names, etc.) that means something, unlike "work".

In any case, I suspect that what you've coded doesn't do what you intend; it won't compile because you have one block of code starting after the do and then another separate block ending with a while.

Also, it is nice if you use the java tag when posting code; look at the Formatting Your Post box on the right, when you are posting.

Dante T. Salvador

Posts: 19
Nickname: anteng
Registered: Nov, 2002

Re: do while Posted: Nov 17, 2002 6:16 AM
Reply to this message Reply
what the hell is you try to do here.

Flat View: This topic has 2 replies on 1 page
Topic: adding the text file to a database Previous Topic   Next Topic Topic: where is the best that could help solving this script

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use