Guest User

Untitled

a guest
May 28th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. // GStrings (double quotes) support interpolation
  2.  
  3. // Interpolation is the act of replacing a placeholder in a string with a
  4. // value when the string is evaluated. A placeholder is surrounded by ${}
  5. // or prefixed with $.
  6.  
  7. def name = 'World'
  8. println "Hello $name"
  9.  
  10. // There are also multi-line strings
  11. def text = '''This is a long text that
  12. spans multiple lines.'''
  13.  
  14. // ... and GStrings
  15.  
  16. name = 'user'
  17. text = """Hello $name!
  18.  
  19. $text"""
  20.  
  21. println(text)
Add Comment
Please, Sign In to add comment