How to Groovy: Strings single (‘test’), double (“test”) and triple quoted (”’)

Groovy Strings

” = is a literal string, / is recognized tho.

“” = vars are recognized.

”’ = triple quoted strings continue over many lines.

The best way to understand is to run this script and play with it.

                    

class GroovyTut {
static void main(String[] args) {

   def name = "Curiousish";
 
  // '' =  is a literal string, / is recognized tho
  // The best way to understand is to run this script and play with it.
  println('I am ${name}\n');

  // "" = vars are recognized
  println("I am $name\n");


  // triple quoted strings continue over many lines
  def multilineString = '''This is a string
  and its mad.''';
 
  println(multilineString);
  
 
    }

}