The if statement with the and (&&) operator

The and (&&) operator is used for absolute results. The and operator returns true if and only if all conditions grouped together are satisfied. In the event that either conditions fail to satisfy the grouped condition, the if statement will fail and the respective code block will be ignored until the grouped condition is satisfied as a whole.

An if statement with an && operator can be written in ampersand form:

var studentMarks = 92
if (studentMarks >= 90 && value < 96) {
println ("A")
}

The and operator can also be written in word form:

if ((studentMarks >= 90) and (value < 96)) {
println ("A")
}

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.234.188