The End Group Delimiter marks the closing of a group. It pairs with the Group delimiter to enclose expressions and function parameters.
The short syntax structure uses the ( ) symbols:
( EXPRESSION )The long syntax structure uses the words GROUP and END GROUP:
GROUP EXPRESSION END GROUPEnd Group serves as the closing delimiter that pairs with Group to:
NEW INT x = ( 5 + 3 ) * 2
PRINTLN x // Displays "16"NEW INT a = 10
NEW INT b = 5
NEW INT c = ( a + b ) * ( a - b )
PRINTLN c // Displays "75"
// Evaluation: (10 + 5) * (10 - 5) = 15 * 5 = 75NEW INT result = ( ( 10 + 5 ) * 2 ) - 3
PRINTLN result // Displays "27"
// Each opening ( must have a matching closing )FUNCTION sayHello ( )
PRINTLN "Hello!"
END FUNCTION
// The ) closes the empty parameter listFUNCTION add ( INT a , INT b )
NEW INT sum = a + b
RETURN sum
END FUNCTION
// The ) closes the parameter list after INT bFUNCTION calculateTotal ( FLOAT price , FLOAT tax , FLOAT discount )
NEW FLOAT total = ( price + tax ) - discount
RETURN total
END FUNCTION
// The ) closes the parameter listFUNCTION getValue ( )
RETURN 42
END FUNCTION
NEW INT x = getValue ( )
// The ) closes the empty argument listFUNCTION multiply ( INT x , INT y )
RETURN x * y
END FUNCTION
NEW INT result = multiply ( 6 , 7 )
PRINTLN result // Displays "42"
// The ) closes the argument list after 7FUNCTION double ( INT n )
RETURN n * 2
END FUNCTION
FUNCTION triple ( INT n )
RETURN n * 3
END FUNCTION
NEW INT result = double ( triple ( 5 ) )
PRINTLN result // Displays "30"
// Inner ) closes triple(5), outer ) closes double(...)NEW INT age = 25
NEW BOOL isAdult = ( age >= 18 )
PRINTLN isAdult // Displays "TRUE"NEW INT score = 85
NEW INT attendance = 90
IF ( score >= 80 ) && ( attendance >= 85 )
PRINTLN "Pass with honors"
END IF
// Two ) symbols close the two grouped comparisonsEvery Group opening must have a matching End Group closing.
NEW INT x = ( 5 + 3 )
// 1 opening ( matches 1 closing )
NEW INT y = ( ( 10 + 5 ) * 2 )
// 2 opening ( match 2 closing )
NEW INT z = ( x + y ) * ( x - y )
// Each pair is properly balancedNEW INT value = ( ( ( 5 + 3 ) * 2 ) - 1 )
PRINTLN value // Displays "15"
// 3 opening ( match 3 closing ) in reverse orderNEW INT i = 1
WHILE ( i <= 5 ) && ( i != 3 )
PRINTLN i
SET i = i + 1
END WHILE
// Two ) close the two grouped conditionsNEW FLOAT length = 10.0
NEW FLOAT width = 5.0
NEW FLOAT height = 3.0
NEW FLOAT volume = ( length * width ) * height
PRINTLN "Volume: " .. volume // Displays "Volume: 150.0"NEW FLOAT principal = 1000.0
NEW FLOAT rate = 0.05
NEW INT years = 2
NEW FLOAT amount = principal * ( ( 1.0 + rate ) * ( 1.0 + rate ) )
PRINTLN "Amount: " .. amountNEW INT x = ( 5 + 3
PRINTLN x // Syntax error! Missing )
// Correct:
NEW INT y = ( 5 + 3 )
PRINTLN yNEW INT x = ( 5 + 3 ) )
PRINTLN x // Syntax error! Extra )
// Correct:
NEW INT y = ( 5 + 3 )
PRINTLN yNEW INT x = ( ( 10 + 5 ) * 2
PRINTLN x // Syntax error! Missing closing )
// Correct:
NEW INT y = ( ( 10 + 5 ) * 2 )
PRINTLN yNEW INT x = ( 5 + ( 3 * 2 )
// Syntax error! Inner group closed but outer group not closed
// Correct:
NEW INT y = ( 5 + ( 3 * 2 ) )
PRINTLN yFUNCTION getValue ( )
RETURN 10
END FUNCTION
NEW INT x = getValue (
PRINTLN x // Syntax error! Missing closing )
// Correct:
NEW INT y = getValue ( )
PRINTLN yFUNCTION add ( INT a , INT b
RETURN a + b
END FUNCTION
// Syntax error! Missing ) after parameter list
// Correct:
FUNCTION add ( INT a , INT b )
RETURN a + b
END FUNCTION