Tutorial 10 : Exceptions
Make your exceptions
Here we are creating our new variable name age
whose value is give 12 and then we define a function of name “change_age” in
which we passing the value of age raise argument error the value of age is
greater than zero than until it will print “Enter Positive number” Then we will
end the function.
And then we create a loop which will take the values of the age. If it’s negative value it will go under the argument error will print “That is an impossible age”. And then we end the loop of the begin then program will execute and givers the result “That is an impossible age”.
Input Output
Difference between double quotes and single quote in the string function in puts
Alright
let’s start by typing an line of the puts in First one we write in double
quotes write “Add Them #{4+5} \n \n” .
and in the Second line we will write puts ‘Add Them #{4+5} \n \n’. and the execute it so lets see what
will happen.
No comments:
Post a Comment