Home » 
        Code Examples » 
        Groovy Code Examples
    
        
    Groovy - Optional return keyword Code Example
    
    
        
    The code for Optional return keyword
int add(int a, int b) {
    return a+b
}
assert add(1, 2) == 3
// The above function can be written as
int add(int a, int b) {
    a+b
}
assert add(1, 2) == 3
    
    
        Code by IncludeHelp,
        on December 28, 2022 21:45