Try IronPython – Interactive Silverlight IronPython Tutorial in the Browser

by Doug Finke on August 27, 2009

in IronPython,PowerShell,Silverlight

Michael Foord, author of  IronPython in Action, is creating a ‘Try Python: Interactive Python Tutorial’ site. Built with Microsoft Silverlight and IronPython.

Fibonacci PowerShell Example

He presents a Fibonacci example and demonstrates multiple assignment for variables.

In this PowerShell example, the second line sets the variables a and b to 0 and 1. Then again in the sixth line. Notice that the expression ($a+$b) is evaluated and then assigned.

Function Fibonacci($n=10) {
    $a, $b = 0, 1            

    while($b -lt $n) {
        $b
        $a, $b = $b, ($a+$b)
    }
}                

Fibonacci 20

{ 0 comments… add one now }

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>