Add (typed)

SWF Action
Action Category: 
Action Details: 
Action Identifier: 
Action Structure: 
Action Length: 
0 byte(s)
Action Stack: 
pop 2 (a), push 1 (a)
Action Operation: 
a1 = pop();
a2 = pop();
if(is_int(a1) && is_int(a2)) {
  i1 := (int)a1;
  i2 := (int)a2;
  r := i1 + i2// sum
else if(is_numeric(a1) && is_numeric(a2)) {
  f1 := (float)a1;
  f2 := (float)a2;
  r := f1 + f2// sum
else {
  s1 := (string)a1;
  s2 := (string)a2;
  r := s1 + s2;   // concatenation
Action Flash Version: 

Pops two numbers or two strings, computes the sum or concatenation and push the result back on the stack.

This action is typed meaning that it will automatically convert the parameters as required and in a very well defined manner1.

  • 1. I need to verify and make sure that the synopsis I give here is indeed correct.