473,396 Members | 2,039 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,396 software developers and data experts.

Recoding with Loop

ll
I'm working in ASP, and I'm trying to refine a site I inherited. In
particular, there was code that looked like this (it checked for 15
different variables, doing it one at a time, "hardcoded," rather than
through a loop):

'-----------------------------------------------------------
if strOut1 <"" then
If strOut1 = "N/A" then
strOut1 = "&nbsp; "
else
strOut1 = strOut1 & ","
end if
end if
if strOut2 <"" then
If strOut2 = "N/A" then
strOut2 = "&nbsp; "
else
strOut2 = strOut2 & ","
end if
end if
'-----------------------------------------------------------

.....and so on.........until we get to strOut15

I'm looking at doing this through a loop and was wondering what the
best way would be? Here's what I have so far:

'-----------------------------------------------------------
for a=1 to 15
if "strOut"&a <"" then
If "strOut"&a = "N/A" then
strOut(a)="&nbsp;"
else
strOut(a) = "strOut"&a & ","
end if
else
strOut(a) = ""
end if
next
'-----------------------------------------------------------

Thanks for any help. Regards - Louis
Jun 27 '08 #1
1 1453
ll wrote:
I'm working in ASP, and I'm trying to refine a site I inherited. In
particular, there was code that looked like this (it checked for 15
different variables, doing it one at a time, "hardcoded," rather than
through a loop):

'-----------------------------------------------------------
if strOut1 <"" then
If strOut1 = "N/A" then
strOut1 = "&nbsp; "
else
strOut1 = strOut1 & ","
end if
end if
if strOut2 <"" then
If strOut2 = "N/A" then
strOut2 = "&nbsp; "
else
strOut2 = strOut2 & ","
end if
end if
'-----------------------------------------------------------

....and so on.........until we get to strOut15

I'm looking at doing this through a loop and was wondering what the
best way would be? Here's what I have so far:

'-----------------------------------------------------------
for a=1 to 15
if "strOut"&a <"" then
If "strOut"&a = "N/A" then
strOut(a)="&nbsp;"
else
strOut(a) = "strOut"&a & ","
end if
else
strOut(a) = ""
end if
next
'-----------------------------------------------------------

Thanks for any help. Regards - Louis
Put the values into an array then loop through the array:
strout=array(strout1,...,strout15)
for a = 0 to 14
if strout(a) ...
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Charles Alexander | last post by:
Hello I am new to php & MySQL - I am trying to retrieve some records from a MySQL table and redisplay them. The data in list form looks like this: Sample_ID Marker_ID Variation ...
3
by: Anand Pillai | last post by:
This is for folks who are familiar with asynchronous event handling in Python using the asyncore module. If you have ever used the asyncore module, you will realize that it's event loop does not...
47
by: Mountain Bikn' Guy | last post by:
Take some standard code such as shown below. It simply loops to add up a series of terms and it produces the correct result. // sum numbers with a loop public int DoSumLooping(int iterations) {...
5
by: Martin Schou | last post by:
Please ignore the extreme simplicity of the task :-) I'm new to C, which explains why I'm doing an exercise like this. In the following tripple nested loop: int digit1 = 1; int digit2 = 0;...
2
by: Alex | last post by:
Compiler - Borland C++ 5.6.4 for Win32 Copyright (c) 1993, 2002 Borland Linker - Turbo Incremental Link 5.65 Copyright (c) 1997-2002 Borland Platform - Win32 (XP) Quite by accident I stumbled...
3
by: Ben R. | last post by:
In an article I was reading (http://www.ftponline.com/vsm/2005_06/magazine/columns/desktopdeveloper/), I read the following: "The ending condition of a VB.NET for loop is evaluated only once,...
32
by: cj | last post by:
When I'm inside a do while loop sometimes it's necessary to jump out of the loop using exit do. I'm also used to being able to jump back and begin the loop again. Not sure which language my...
9
by: feck | last post by:
Hi, Got a query, don't know if anyone would be kind enough to help... I have to either match a string exactly eg "123456789ABCDEF123456789ABCDEF" == "123456789ABCDEF123456789ABCDEF", or if a...
2
ADezii
by: ADezii | last post by:
If you are executing a code segment for a fixed number of iterations, always use a For...Next Loop instead of a Do...Loop, since it is significantly faster. Each pass through a Do...Loop that...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.