fork download
  1. Boolean isOK; // Default value is `false`
  2. Integer x;
  3. String theString = 'Hello';
  4.  
  5. if (isOK == false && theString == 'Hello') {
  6. x = 1; // This condition is true: (false == false) && ('Hello' == 'Hello')
  7. } else if (isOK == true && theString == 'Hello') {
  8. x = 2; // This condition is false: (false == true) && ('Hello' == 'Hello')
  9. } else if (isOK != null && theString == 'Hello') {
  10. x = 3; // This condition is false: (false != null) && ('Hello' == 'Hello')
  11. } else {
  12. x = 4; // This block will not execute
  13. }
Success #stdin #stdout #stderr 0.01s 10004KB
stdin
Standard input is empty
stdout
Object: nil error: did not understand #if
MessageNotUnderstood(Exception)>>signal (ExcHandling.st:254)
UndefinedObject(Object)>>doesNotUnderstand: #if (SysExcept.st:1448)
UndefinedObject>>executeStatements (prog:5)
Object: false error: did not understand #&&
MessageNotUnderstood(Exception)>>signal (ExcHandling.st:254)
False(Object)>>doesNotUnderstand: #&& (SysExcept.st:1448)
UndefinedObject>>executeStatements (prog:5)
stderr
./prog:1: Invalid character `
./prog:1: sending `false', most likely you forgot a period
./prog:1: Invalid character `
./prog:6: parse error, expected '}'
./prog:9: expected expression
./prog:10: expected expression