Skip to content

Instantly share code, notes, and snippets.

@ninmonkey
Last active October 17, 2024 17:40
Show Gist options
  • Select an option

  • Save ninmonkey/754b2c4cf4ef5e700b484c5487aef22d to your computer and use it in GitHub Desktop.

Select an option

Save ninmonkey/754b2c4cf4ef5e700b484c5487aef22d to your computer and use it in GitHub Desktop.
Pwsh Line Continuations are Permissive

Sometimes line continuations are quite permissive

Starting code

[datetime]::ParseExact( 'septiembre', 'MMMM', (get-culture 'es') ).ToString('MMMM', (get-culture 'es'))

[a]

[datetime]::

    ParseExact( 
        'septiembre', 'MMMM', (get-culture 'es') 
    ).ToString(
        'MMMM', (get-culture 'es') )

[b]

Multiple blank lines don't break it

[datetime]::

    ParseExact( 
        'septiembre', 'MMMM', (get-culture 'es') 
    ).


    ToString(
        'MMMM', (get-culture 'es') )

[c]

[datetime]::


    ParseExact(
        'septiembre', 'MMMM', (get-culture 'es') ).


    ToString(
        'MMMM', (get-culture 'es') )
        

[d]

[datetime]::


    ParseExact(
        'septiembre', 'MMMM', (get-culture 'es') ).

    <# 
         foo bar other stuff 
         comments inside the method call
    #>

    ToString(
        'MMMM', (get-culture 'es') )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment