Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library
← Back to context

Comment by stOneskull

9 hours ago

Nim:

  var mylist = [64, 34, 25, 12, 22, 11, 90, 5]

  let n = mylist.len
  for i in 0..n-2:
    for j in 0..n-i-2:
      if mylist[j] > mylist[j + 1]:
        swap(mylist[j], mylist[j + 1])

  echo mylist

0 comments

stOneskull

Reply

No comments yet

Contribute on Hacker News ↗

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities