Convert logic to string

I am debugging and trying to print some logic value on the screen.

But I have no idea how to print anything that is not of type string.
image

1 Like

yeah no ToString for logic. +vote to adding this
You have to do the less elegant way:

    if (Logicc = true):
        Logger.Print("true")
    else:
        Logger.Print("false")
2 Likes

Yes - it is a pain not having it.

Here is another variation of what you suggested:

Logger.Print(if(Logicc?) {"true"} else {"false"})

In the future maybe we could add an extension function for logic :thinking: :

Logger.Print(Logicc.ToString())
4 Likes

I would love that addition :heart_eyes:

1 Like

I actually created a one-liner extension method for this yesterday. Seemed to work as expected. I added the <computes> so that it could be called from a failure context, but I’m still a little green in that area of verse, so maybe that’s not a good thing to do.

(Logic : logic).ToString<public>()<computes> : []char = if (Logic?) then "true" else "false"

4 Likes