22.08.2013 Views

Functions Handout

Functions Handout

Functions Handout

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

IDL<br />

FUNCTION george, x, y<br />

END<br />

result = x^2 * sin(y)<br />

return,result<br />

IDL> .run george<br />

IDL> a = 1.2<br />

IDL> b = 3.4<br />

IDL> junk = george(a,b)<br />

IDL> print,junk<br />

Python<br />

def george(x,y):<br />

result = x**2 * sin(y)<br />

return result<br />

# Main Part of Program<br />

def main():<br />

a = 1.2<br />

b = 3.4<br />

junk = george(a,b)<br />

print junk<br />

if __name__ == "__main__":<br />

main()

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!