Re: random numbers

new topic     » goto parent     » topic index » view thread      » older message » newer message

Hi Jason,

you wrote:

<snip>

> Does any other compiled or interpreted language have a built-in swap?

Oh yes, oh yes! smile

> I can't
> recall coming across one, even though it is a pretty common operation.

It is implemented in many BASIC flavours:
     SWAP a, b

Also interesting in this regard is Lua. Lua allows multiple assignment
in one command, e.g.:
     a, b = 1, 3
which is the same as:
     a = 1
     b = 3

This feature can be used for swapping:
     a, b = b, a

No joke, that actually works fine in Lua. Cool, no? smile

Regards,
   Juergen

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu