• I have tested the code and it is giving an error. I think end statement is not required at the last line, just comment that out and it works