Groovy web console

subscribe to the feed Subscribe
to this

01 Data Types

Published 8 months ago by ST with tags groovy
Actions Execute script  ▶ Edit in console Back to console Show/hide line numbers View recent scripts
//Literals and data types

12 //integer
1.45 // floating-point integer
true // (or false) boolean
'Hello' // string
null // void/undefined object reference

newDate() // instances of other Java or Groovy classes (see e.g. API documentation)

// Declaring variables

// untyped
def str1 = 'Hello'
// or typed
String str2 = 'World'

println(str1 + ' ' + str2)

// an uninitialized variable is null (unless it is typed as a primitive)
def none