• 4wd@programming.dev
    link
    fedilink
    arrow-up
    20
    arrow-down
    1
    ·
    4 months ago

    In Elixir, we mark statuses by using a question mark at the end of the variable name. Something like this:

    authorized? = user |> get_something() |> ensure_authorized?()
    

    I like this better than the is_ prefix

      • Faresh@lemmy.ml
        link
        fedilink
        English
        arrow-up
        8
        ·
        4 months ago

        If it’s like Lisp, then ? is just part of the symbol and doesn’t have any special syntatic meaning. In different Lisps it’s also convention to end predicate names with a ? or with P (p for predicate)