Skip to content

isdefined not working as intended #4385

@macookinerbarry-png

Description

@macookinerbarry-png

problems with using isdefined()

I'm trying to use "isdefined()" in a way where I have an if() block to check if the variable is defined, and if the condition returns true, I want to return the value of the variable. But no matter what I do, "isdefined()" either returns false or the complete string: "isdefined(@variable)";

Current behavior:

@a: blue;
@b: if((isdefined(@a)), @a, black);

@b = black

Expected behavior:

@a: blue;
@b: if((isdefined(@a)), @a, black);

@b = blue

also

Current behavior:

@b: isdefined(@a);

@b = false

✅ which is correct

@a:red;
@b: isdefined(@a);

@b = isdefined(red);

❌ .....should be true

Also, not defining @a will always throw an error "@A is undefined"

The funny thing is this works perfectly fine when trying to use this on the less playground.

Environment information:
I tested this in VS code using the CDN links to compile LESS

  • less version: 4.4.2
  • operating system: windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions