Guest User

Untitled

a guest
Apr 23rd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. component {
  2.     variables.privateVar = "";
  3.  
  4.     public void function Init(){
  5.        
  6.     }
  7.  
  8.     public void function testThis(struct myStruct = {}){
  9.  
  10.         if(structKeyExists(myStruct,"fruit")){
  11.             myStruct.fruit = "banana";
  12.         }
  13.         else if(structKeyExists(myStruct,"animal")){
  14.             myStruct.animal = "tiger";
  15.         }
  16.     }
  17. }
  18.  
  19. //invocation
  20. <cfscript>
  21.     test = new Test();
  22.  
  23.     myStruct = {fruit = ""};
  24.     test.testThis(myStruct);
  25.  
  26.     //myStruct.fruit = banana
  27.  
  28.     writedump(myStruct);
  29.  
  30.     myStruct = {animal = ""};
  31.     test.testThis(myStruct);
  32.  
  33.     //myStruct.fruit = banana
  34.     writedump(myStruct);
  35. </cfscript>
Add Comment
Please, Sign In to add comment