loops

hey,

can anyone tell me if i can do an elseif kind of loop...

effectively

if p is 27 then stay at 27
else if p is not 27 then do function...

thanks
t

Re: loops

thom wrote:if p is 27 then stay at 27
else if p is not 27 then do function

sure you just need to use

if p != 27:
function

shark[/code]

loops

sorry,

that was a pooor example that i made up...

i think i do need an else if kind of statement for this...

if |a| == 0: a = 0.
else if |a| > b: a = b * a/|a|.

thanks
t

loops

can you just not use this. don't understand why the else is needed at all?

if |a| == 0: a = 0.

if |a| > b: a = b * a/|a|.

shark

loops

ok i think you have a point there shark...

but does anyone know if i can do else if statements? jk, i guess you'll know!

thanks
t

loops

if |a| == 0:
    a = 0. 
else if |a| > b:
    a = b * a/|a|.

If you want more than one line:

if |a| == 0:
{
    a = 0.
    other stuff
} 
else if |a| > b:
{
    a = b * a/|a|.
    more stuff
}

loops

thanks PowerMacX, you know wehn you have those days... it all seems so stupidly obvious today.

t

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.