fork download
  1. num = 1;
  2. sum = 0;
  3.  
  4. while(num <= 20){
  5. if(num % 2 == 0){
  6. sum = sum + num
  7. }
  8. num ++;
  9. }
  10.  
  11. System.debug('Sum of numbers at even positions: ' + sum);
Success #stdin #stdout #stderr 0.01s 8884KB
stdin
Standard input is empty
stdout
Object: nil error: did not understand #sum
MessageNotUnderstood(Exception)>>signal (ExcHandling.st:254)
UndefinedObject(Object)>>doesNotUnderstand: #sum (SysExcept.st:1448)
UndefinedObject>>executeStatements (prog:2)
stderr
./prog:2: expected expression