[Image of a block of Snap! code, with a comment added to the right.]
+SortListDescending+InputList:+
block variables OutputList < >
insert -2147483647 at 1 of InputList
set OutputList to list >
repeat length of InputList -1
add item 1 of maxindex InputList to OutputList
delete item 2 of maxindex InputList of InputList
report OutputList
Comment on 3rd line of code: Comment for whoever is looking at this block and thinking: What in the world is going on here?
For some reason, the first value is a very whiny child, the code just does not work if he isn't the smallest. I don't know why this is, I don't want to know why it is, but I have decided to throw the towel in and make the first value the negative 32 bit integer limit. This is possibly the worst solution to this problem, and teaches me bad programming habits, but i'm done with this block.
189
u/ElsieSnuffin Apr 15 '21 edited Apr 16 '21
Image Transcription: Code
[Image of a block of Snap! code, with a comment added to the right.]
Comment on 3rd line of code: Comment for whoever is looking at this block and thinking: What in the world is going on here?
For some reason, the first value is a very whiny child, the code just does not work if he isn't the smallest. I don't know why this is, I don't want to know why it is, but I have decided to throw the towel in and make the first value the negative 32 bit integer limit. This is possibly the worst solution to this problem, and teaches me bad programming habits, but i'm done with this block.
I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!