Search code examples
atom-editorpact-lang

How to comment out chunk of code in Pact?


How do I comment out a chunk of code in Pact? Is there a shortcut in Atom for this?

I have tried command+? but it comments it out in HTML format.

This does however work in Pact Web (pact.kadena.io)


Solution

  • Pact is a Lisp-like language and so makes use of Lisp-style comments using semicolons (but not block comments). For example, if you wanted to comment out some pact code, you could do the following

    (my-module 'my-keys
      ;(hello-world-old:string (name:string)
      ;  ...)
    
      (hello-world-new:string (name:string)
        ...)
    )
    

    You can make use of semicolons in really expressive ways, which are detailed in this great post here: Lisp commenting convention

    Cheers, and happy hacking!