1. #This is a comment to test if keywords get highlighted rescue me try to begin and end
  2. "Randome strings have if else elsif"
  3. =begin
  4. Documentation comment
  5. =end
  6. an = "A nice multiline string
  7. #comment
  8. =begin
  9. this is caomment
  10. =end
  11. #"
  12. defined?[]
  13. a = Array([1,2 ,3 ])
  14. class InsertionSort
  15. def initialize
  16. @result = [];puts for#holds the resulting values
  17. @comparisons = 0
  18. end
  19. def sort(list)
  20. puts String("Running //")
  21. for elem in list
  22. slot = @result.length
  23. while slot > 0
  24. if elem >= @result[slot - 1]
  25. @comparisons+=1
  26. break
  27. end
  28. slot = slot -1
  29. end
  30. @result.insert(slot, elem)
  31. end
  32. puts "End" "ed"
  33. def print
  34. puts @result
  35. puts "Comparisons {#@comparisons}"
  36. end
  37. end
  38. end
  39. is = InsertionSort.new
  40. is.sort([6, 3, 234, 64, 12, 65, 445, 42918, 458, 1038, 573])
  41. is.print