Skip to content

Boolean function path_exists() returns string not boolean; not compatible with short-circuit && and || #2927

@cspotcode

Description

@cspotcode

Not sure if this is intended or not.

I was trying to if path_exists(foo) { a } else { b } or path_exists(foo) && a || b

It wasn't working, I was getting a syntax error. if path_exists(foo) == true also failed. I had to change to path_exists(foo) == 'true'

Is it worth mentioning in the readme that it returns a string, not a boolean? And the caveat with short-circuit logic, since if it returns false, that's not an empty string, won't short-circuit with && or ||.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions