473,382 Members | 1,646 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Do-while to For-if loop

can somebody convert :

do {

newNumber = columnMultiple + getNewNumber() + 1;
}
while(usedNumbers[newNumber]);{

if (!usedNumbers[newNumber]) {

usedNumbers[newNumber] = true;

document.getElementById(currentSquare).innerHTML = newNumber;
}
}



to a for loop code
Mar 17 '12 #1
3 1566
r035198x
13,262 8TB
1.) Java != Javascript
2.) Use code tags when posting code
3.) What have you tried?
Mar 17 '12 #2
i tried to use

for(newNumber>0; usedNumbers[newNumber]; newNumber++){
if (!usedNumbers[newNumber]) {
document.getElementById(currentSquare).innerHTML = newNumber;
}
}
Mar 17 '12 #3
//try this..

newNumber = columnMultiple + getNewNumber();

for(usedNumbers[newNumber] = true;usedNumbers[newNumber] = false;newNumber = newNumber + 1) {
if(!usedNumbers[newNumber]) {
usedNumbers[newNumber]=true;
document.getElementById(currentSquare).innerHTML=n ewNumber;
}
}

//i hope it helps..

for(initialization;condition to terminate loop;inc/dec ++/--) {
statements to do or what will happen when looping occured..
}

//good luck! =)
Mar 17 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Phil Powell | last post by:
$fbArray = array($feedbackCategoryArray => $feedbackCategoryArray); I can't begin to fathom in my befuddled mind how to sort this array $fbArray into alphabetical order according to...
4
by: Adams-Blake Co. | last post by:
What technique do you folks use to keep your passwords and user names out of the phpMyAdmin config.inc file. Thanks, Al
15
by: Phil Powell | last post by:
<b>Agency 4</b> <input type="radio" name="permission" value="1" checked> Yes <input type="radio" name="permission" value="0" > No <br> <b>Agency 5</b> <input type="radio" name="permission"...
14
by: Justin Kozuch | last post by:
Hi All, I have created the beginnings of an RSVP script so that people can confirm/decline an invitation I send via email. When they go to the RSVP script, (www.site.com/rsvp.php), they enter...
1
by: NotGiven | last post by:
I have the following at the beginning of the PHP page: <?php require_once('Connections/conn.php'); ?> I want to hide the connection file, "conn.php", so it's out of the web accessible file...
2
by: NotGiven | last post by:
I am using SSL to go from one page to the next. Do I still need to excrypt session IDs? Thanks. srg at charlottenet dot com
13
by: Kristof Goossens | last post by:
Hi you guys, in the following insert the strtolower wont put the chars in lowercase. Any ideas what i'm doing wrong? the code: $qryInsRel = "INSERT INTO \"tblrelations\" (rid, vcfirstname,...
8
by: Chris | last post by:
Can anybody help. I need to read a txt file backwords line by line. Can anybody help me do this. Thanks Chris
2
by: Phil Powell | last post by:
exec("chmod 0644 $fyl 2>&1"); This PHP command, as you know, will evoke an EXEC to do CHMOD on the command line. Everything works fine, including printing the appropriate error message piped...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.