[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Displaying array elements in order

Pragash Mr.

7/15/2008 9:29:00 AM

Hi,

for example


a=[12,354,633,68,85]
<%for i in a%>
<%z=Document.find(i)%>
<%=z.name%>
<%end%>

Here the result is displaying randomly in browser
but i want to display the result in the array order
i.e first 12 then followed by 354,633,68,85

If you have any solution plz reply
--
Posted via http://www.ruby-....

5 Answers

Mikael Høilund

7/15/2008 10:09:00 AM

0

On Jul 15, 2008, at 11:28, Pragash Mr. wrote:

> a=3D[12,354,633,68,85]
> <%for i in a%>
> <%z=3DDocument.find(i)%>
> <%=3Dz.name%>
> <%end%>
>
> Here the result is displaying randomly in browser
> but i want to display the result in the array order
> i.e first 12 then followed by 354,633,68,85

If that's happening, the array is ordered randomly before the `for` =20
construct. Arrays are inherently ordered, so using a `for` will always =20=

yield the elements in the order they appear in the array. Try =20
inspecting the array before looping over it to see which order the =20
elements are in.

--=20
Mikael H=F8ilund
http://ho...


Pragash Mr.

7/15/2008 10:32:00 AM

0

Mikael Høilund wrote:
> On Jul 15, 2008, at 11:28, Pragash Mr. wrote:
>
>> a=[12,354,633,68,85]
>> <%for i in a%>
>> <%z=Document.find(i)%>
>> <%=z.name%>
>> <%end%>
>>
>> Here the result is displaying randomly in browser
>> but i want to display the result in the array order
>> i.e first 12 then followed by 354,633,68,85
>
> If that's happening, the array is ordered randomly before the `for`
> construct. Arrays are inherently ordered, so using a `for` will always
> yield the elements in the order they appear in the array. Try
> inspecting the array before looping over it to see which order the
> elements are in.


Hi,
Before the for loop also i checked but it is displaying in random order
even though aray order is [12,354,633,68,85]
but i have one doubt if it is ajax call then it will display in random
order... plz reply
--
Posted via http://www.ruby-....

Greg Carr

5/4/2014 12:55:00 AM

0

On 03/05/2014 3:49 PM, B. H. O. wrote:
> On 28 Apr 2014, "Barack The Bumbler"<leftards@socialist-nannies.com>
> posted some news:6c72e6645ecdeac280e7f578c228c9cc@dizum.com:
>
>> Just yesterday, I wrote about how unpopular the British
>> healthcare system has become. Today comes news that the man
>> largely responsible for Canada's conversion to a single-payer
>> health care system has admitted the system's failure:
>>
>> "Back in the 1960s, (Claude) Castonguay chaired a Canadian
>> government committee studying health reform and recommended that
>> his home province of Quebec ? then the largest and most affluent
>> in the country ? adopt government-administered health care,
>> covering all citizens through tax levies.
>>
>> The government followed his advice, leading to his modern-day
>> moniker: "the father of Quebec medicare." Even this title seems
>> modest; Castonguay's work triggered a domino effect across the
>> country, until eventually his ideas were implemented from coast
>> to coast."
>>
>> Four decades later, as the chairman of a government committee
>> reviewing Quebec health care this year, Castonguay concluded
>> that the system is in "crisis."
>>
>> "We thought we could resolve the system's problems by rationing
>> services or injecting massive amounts of new money into it,"
>> says Castonguay. But now he prescribes a radical overhaul: "We
>> are proposing to give a greater role to the private sector so
>> that people can exercise freedom of choice."
>>
>> As more and more nations throughout the world seek to infuse
>> more private, market-based solutions into their government-
>> controlled healthcare systems, for some reason lefties in this
>> country want to make the same mistake that countries like Canada
>> made decades ago. Let's hope voters in North Carolina and across
>> the US wake up, or else we may be forced to confront "rationing
>> services or injecting massive amounts of new money" into a
>> system that even one of its pioneers admits to being a failure.
>>
>> http://civitasreview.com/healthcare/father-of-canadi...
>> care-admits-its-a-failure/
>
> American democrats will never admit that Barack Hussein Obama is a total
> failure.
>
> That would be "honest" and we just couldn't have that.
>
I was hospitalized for two weeks some years ago and it didn't cost me a
cent out of my pocket. Sure there are problems with Cdn healthcare but
if you want to pay for American care there is always that option. Cdn
health care is better than the American system in my opinion and all 5
parties in Parliament at least pay lip service to preserving health
care. I go to a doctor twice a year and get blood work done annually and
nothing comes out of my wallet.

--
*Read and obey the Bible*

BeamMeUpScotty

5/4/2014 3:38:00 PM

0

On 5/3/2014 6:49 PM, B. H. O. wrote:
> On 28 Apr 2014, "Barack The Bumbler" <leftards@socialist-nannies.com>
> posted some news:6c72e6645ecdeac280e7f578c228c9cc@dizum.com:
>
>> Just yesterday, I wrote about how unpopular the British
>> healthcare system has become. Today comes news that the man
>> largely responsible for Canada's conversion to a single-payer
>> health care system has admitted the system's failure:
>>
>> "Back in the 1960s, (Claude) Castonguay chaired a Canadian
>> government committee studying health reform and recommended that
>> his home province of Quebec ? then the largest and most affluent
>> in the country ? adopt government-administered health care,
>> covering all citizens through tax levies.
>>
>> The government followed his advice, leading to his modern-day
>> moniker: "the father of Quebec medicare." Even this title seems
>> modest; Castonguay's work triggered a domino effect across the
>> country, until eventually his ideas were implemented from coast
>> to coast."
>>
>> Four decades later, as the chairman of a government committee
>> reviewing Quebec health care this year, Castonguay concluded
>> that the system is in "crisis."
>>
>> "We thought we could resolve the system's problems by rationing
>> services or injecting massive amounts of new money into it,"
>> says Castonguay. But now he prescribes a radical overhaul: "We
>> are proposing to give a greater role to the private sector so
>> that people can exercise freedom of choice."
>>
>> As more and more nations throughout the world seek to infuse
>> more private, market-based solutions into their government-
>> controlled healthcare systems, for some reason lefties in this
>> country want to make the same mistake that countries like Canada
>> made decades ago. Let's hope voters in North Carolina and across
>> the US wake up, or else we may be forced to confront "rationing
>> services or injecting massive amounts of new money" into a
>> system that even one of its pioneers admits to being a failure.
>>
>> http://civitasreview.com/healthcare/father-of-canadi...
>> care-admits-its-a-failure/
>
> American democrats will never admit that Barack Hussein Obama is a total
> failure.
>
> That would be "honest" and we just couldn't have that.
>
What the American people don't know can't.....




spamthespammers

5/4/2014 11:43:00 PM

0




=============================================================
TOPIC HAS NOTHING TO DO WITH CANADIAN NEWSGROUPS - DROP DEAD
=============================================================


On 5/4/2014 8:38 AM, BeamMeUpScotty wrote:

I know I'm a spammer into non-relevant groups again. I'm a total ass
and can't control myself.