flow.nut 569 B

123456789101112131415161718192021222324252627282930313233
  1. function min(x,y)
  2. return x<y?x:y;
  3. function max(x,y)
  4. return x>y?x:y;
  5. if(min(100,200)>max(50,20))
  6. print("I'm useless statement just to show up the if/else\n");
  7. else
  8. print("squirrel!!\n");
  9. print("\n")
  10. function typy(obj)
  11. {
  12. switch(typeof obj)
  13. {
  14. case "integer":
  15. case "float":
  16. return "is a number";
  17. case "table":
  18. case "array":
  19. return "is a container";
  20. default:
  21. return "is other stuff"
  22. }
  23. }
  24. local a=1,b={},c=function(a,b){return a+b;}
  25. print("a "+typy(a)+"\n");
  26. print("b "+typy(b)+"\n");
  27. print("c "+typy(c)+"\n");