If statements

Conditional statements are standard ‘if’-statements. They are defined by a single ‘if’-branch, followed by a set of ‘else-if’-branches, and a possible ‘else’-branch.

Arguments to the if/else-if-branches are Boolean expressions.

A conditional statement takes a logical expression as argument.

if (c.getStereotype () = “entity”) {
   // statements
} else if (c.getStereoType() = “service”) {
   // statements
} else {
   // statements
}

if (c.ownedOperations.size() > 0 and c.name.startsWith(“C”)) {
       // statements
} else {
       // statements

}