Last active
November 11, 2022 07:38
Revisions
-
michalbcz revised this gist
Nov 11, 2022 . No changes.There are no files selected for viewing
-
michalbcz revised this gist
Nov 11, 2022 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,8 +14,8 @@ import groovy.io.* // from statement below any GString with interpolation or comments doesn't work (ie. cannot be compiled) def dir = new File(/C:\Users\/) def expressionWorks = 1+1 println expressionWorks println "GString without interpolation works" println 'String works' -
michalbcz created this gist
Nov 11, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ /* Example what happened when you use backslash in Slashy string (https://groovy-lang.org/syntax.html#_slashy_string) Note: there is a note that you are not supposed to do that in https://groovy-lang.org/syntax.html#_special_cases "A consequence of slash escaping is that a slashy string can’t end with a backslash" */ import groovy.io.* // def dir = new File(/C:\Users/) // WORKS (removed last slash) // def dir = new File("C:\\Users\\") // WORKS // def dir = new File("C:\\Users") // WORKS // from statement below any GString with interpolation or comments doesn't work (ie. cannot be compiled) def dir = new File(/C:\Users\/) def statementWorks = 1+1 println statementWorks println "GString without interpolation works" println 'String works' dir.eachFile({ file -> "expression below is not working, remove it (commenting doesn't work either) and it starts to work" println "${file}" "working expressions" println file println "file" })