+ 1
How we use boolean expression in if condition for a alphabet and special character ?
For example I want to write a code that cheek a variable if it is even or odd and if the input variable isn't a number the I want output to be invalid. What should I do to make it right?
4 Réponses
+ 4
In general the numbers can be tested for even and odd with modulo 2 (x%2 == 0) division. For another things will be better to know in which language you want to code.
+ 2
John ,
please modify your post by naming the programming language
+ 1
next().charAt(0);
0
You can use an if-else statement, a switch statement or catching exceptions. The way you implement it syntactically is very dependent on the language though.