Lucas_3D

Untitled

Apr 17th, 2022 (edited)
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. theArray = #(1,2,3,4)
  2. fn printArrayCombinations _lengthToPrint _theArray =
  3. (
  4. finalArray = #()
  5. for i = 1 to _theArray.count do
  6. (
  7. allTheSubArrays = #()
  8. subArray = #()
  9. firstMember = _theArray[i]
  10. for n = 1 to _theArray.count do
  11. (
  12. if n != firstMember do
  13. (
  14. subArray = #(firstMember)
  15. append subArray _theArray[n]
  16. )
  17. append allTheSubArrays subArray
  18. )
  19. append finalArray allTheSubArrays
  20. )
  21. return finalArray
  22. )
  23. printArrayCombinations 2 theArray
Add Comment
Please, Sign In to add comment