Donnerstag, 26. November 2009

In Python it would be basic. in PowerShell ???

I hope there is a better solution in Powershell to build $list

$list = @()            

function add-Tupple
{
$index = $list.count
$global:list += 1
$global:list[$index] = $args
}


add-Tupple 'Ps' 'has object pipelines'
add-Tupple 'Python' 'has natural nested datastructures'

$list.count

foreach ($item in $list)
{
$code, $name = $item
"Code: $code"
"Name: $name"
}

# in python (('Ps', 'has object pipelines'), ('Python', 'has natural nested datastructures'))

2 Kommentare:

  1. It is exactly the same (Unless I'm missing something)

    (('ps', 'has object pipelines'),('Python AND ps', 'have natural nested datastructures'))

    AntwortenLöschen