PowerShell error that is not a true error, is actually correct code:Unexpected token '‬' in expression or statement.

Unexpected token '‬' in expression or statement.
At line:1 char:39
+ @("Saturn I", 150, (4746835443037975)‬, (150949367.0886076)‬)
+                                       ~
Missing argument in parameter list.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken

What on earth does this mean? The statement (below) is completely valid. I have removed parenthesis but still a bad result.

@("Saturn I", 482, 1525316455696203, (485050632.9113924)‬, 9070)

If you are curious about the rest of the code, here it is.

# This line is not a part of the code. The title of this is "rocket.psm1" and is a module.
function getStage1($name){ # name, burnTimeSeconds, heightReachedMeters, costDollars
    $stage1 = @(
        @("Titan I", 140, 949152.5423728814, 711864.406779661),
        @("Falcon 1", 169, 1140893.47079, 617915.9049360146, 27806215)
        @("Saturn I", 150, (4746835443037975)‬, (150949367.0886076)‬)
    )
}
function getStage2($name){ # name, burnTimeSeconds, heightReachedMeters, costDollars, payloadLEOkg
    $stage2 = @(
        @("Titan I", 155, 1050847.457627119,‬ 788135593220339, 1),
        @("Falcon 1", 378, 859106.52921, 1382084.095063985, 62193784, 670)
        @("Saturn I", 482, 1525316455696203, (485050632.9113924)‬, 9070)
    )
}

Please help me, there is no error yet PowerShell detects an error and prevents me from importing (or even running) this module.

Thanks big time.

  • I'm sure you noticed the error on lines 5 and 12. The commas after the lines have been added and this still did not fix this. On top of this, the code has been changed to the following during development:

    function getStage1($name){ # name, burnTimeSeconds, heightReachedMeters, costDollars
        $stage1 = @(
            @("Titan I", 140, 949152.5423728814, 711864.406779661),
            @("Falcon 1", 169, 1140893.47079, 617915.9049360146, 27806215),
            @("Saturn I", 150, (4746835443037975)‬, (150949367.0886076)‬)
        )
        $global:x = 0
        while($global:x -lt $stage1.Length){
            if($stage1[$global:x][0] -eq $name){return $stage1[$global:x]}
            $global:x = $global:x + 1
        }
    }
    function getStage2($name){ # name, burnTimeSeconds, heightReachedMeters, costDollars, payloadLEOkg
        $stage2 = @(
            @("Titan I", 155, 1050847.457627119,‬ 788135593220339, 1),
            @("Falcon 1", 378, 859106.52921, 1382084.095063985, 62193784, 670),
            @("Saturn I", 482, 1525316455696203, (485050632.9113924)‬, 9070)
        )
        $global:x = 0
        while($global:x -lt $stage2.Length){
            if($stage2[$global:x][0] -eq $name){return $stage2[$global:x]}
            $global:x = $global:x + 1
        }
    }