+ 2
Your code won't compile, if you have not declared x before using it (in print statement).
Also, type of Exception must be specified in catch.
catch (e: Exception)
+ 1
Did you read both parts of my comment?
If you do not declare the variable X, the code won't even compile, you cannot run it at all.
You declare a variable with val or var keyword.
And if the type is not nullable, you also need to initialize it.