3 ms·
When this buggy method is compiled (not run) with Smalltalk, errors and warnings are shown. The code cannot be run because it failed to compile. hnQuestion |
by igouy 2y ago
When this buggy method is compiled (not run) with Smalltalk, errors and warnings are shown. The code cannot be run because it failed to compile.
hnQuestion
| list max |
list := #(1 8 4 5 3).
! Syntax Error: Nothing more expected
1 to: list size do: [:i |
max < (list at: i)
? Uses ifTrue:/ifFalse: instead of min: or max:
ifTrue: [max := (list at: i)].
ifFalse: [max := max].
].
- Izkata 2y agoFor future reference, indent with 2 spaces to get code formatting. https://news.ycombinator.com/formatdoc https://news.ycombinator.com/formatdoc
- igouy 2y agoFor future reference, does "code formatting" provide a way to distinguish list := #(1 8 4 5 3). from ! Syntax Error: Nothing more expected as-well-as from comment text ?