Someone please explain to me in simple terms the function of various conditional statement and how or where they are used... thank you
Are you referring to the conditional ternary operator? I can show you the java version.
I mean things like the if statement...i do not know if we are talking of the same
For simplicity, we will refer to the first line as the if clause. The if clause begins with the word if, followed by a condition, which is an expression that will be evaluated as either true or false.
if condition: statement statement // this is for python
it is similar in java as well, i believe...so will the program will keep running if the statement is true?
yes... you can have else if or else statements as well to tell your program what to do if certain condition is not met
if you want the program to end when the condition is false - you can use the ! operator, ``` boolean condition = false; if(!condition) System.exit(0); ``` that will end the program if it's false. for general if else statements -- ``` if(boolean variable == true) { //do these statements } else { //do these statements } ```
does the 0 inside System.exit(0); have any significance?
Join our real-time social learning platform and learn together with your friends!