What does a double exclamation mark (!!) in Fsharp / FAKE?

前端 未结 1 1614
梦谈多话
梦谈多话 2021-01-17 17:19

I\'ve come across the following code and can not understand what operation the double exclamation marks provide. This code-snipet is from a FAKE script used in a CICD system

相关标签:
1条回答
  • 2021-01-17 17:45

    The !! operator takes a file pattern and returns a collection of files matching the pattern.

    For example, if you want to print all text files in the current folder, you can write:

    for file in !! "*.txt" do
      printfn "%s" file
    

    If you look at the operator definition in the source code, you can see that it is just an alias for creating a IGlobbingPattern value (see the type definition) that includes files given by the specified pattern. The IGlobbingPattern type implements IEnumerable, so you can iterate over the files, but you can do a couple of other things with IGlobbingPattern such as combining two file sets using ++ or removing some files from a file set using --.

    0 讨论(0)
提交回复
热议问题