g | x | w | all
Bytes Lang Time Link
022JavaScript V8250626T065917ZSteve Be
144ObjectiveC macOS250618T193519ZmacOSist
101Swift 6 macOS250606T012127ZmacOSist
nanCommodore 64 Assembler250606T111657ZJani Joe
044JavaScript180624T171744Zguest271
059Ruby161216T032311Zanna328p

JavaScript (V8), 22 bytes

_=>a=(this.a||11)-1||z

Try it online!

This works in TIO but doesn't work in Node or browser environments - dereferencing a non-existent variable.

JavaScript (V8), 24 bytes

_=>a=(this.a||11)-1||a``

Try it online!

Crashes with Uncaught TypeError TypeError: a is not a function

Lots of alternatives for that last bit: a(), _._ etc.

Objective-C (macOS, Cocoa APIs only), 151 144 bytes

#import<ARKit/data.h>
int main(){id d=[NSUserDefaults new];int c=[d floatForKey:@""];NSLog(@"%d",c=c?c-1:10,c||d[0]);[d setFloat:c forKey:@""];}

To reset, run defaults delete a.out "" in a shell (where a.out is the executable filename).

Execution

$ /usr/bin/clang -framework Foundation main.m
…
2 warnings generated.

$ ./a.out
2025-06-18 14:24:47.059 a.out[9516:347682] 10

$ ./a.out
2025-06-18 14:25:00.957 a.out[9520:347951] 9

$ ./a.out
2025-06-18 14:25:13.050 a.out[9524:348099] 8

$ # …

$ ./a.out
2025-06-18 14:25:27.861 a.out[9552:348360] 1

$ ./a.out
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSUserDefaults objectAtIndexedSubscript:]: unrecognized selector sent to instance 0x102820f10'
…
Abort trap: 6

Swift 6 (macOS), 151 146 101 bytes

import AVKit
let d=UserDefaults(),c=d.object(forKey:"")as?Int ?? 10
print(c*c/c)
d.set(c-1,forKey:"")

The AVKit framework re-exports Foundation, so we can import it instead of Foundation to save 5 bytes.

To reset, run defaults delete swift-frontend "" in a shell.

Execution

$ swift CrashOff.swift
10

$ swift CrashOff.swift
9

$ # ...

$ swift CrashOff.swift
1

$ swift CrashOff.swift
Swift/IntegerTypes.swift:9012: Fatal error: Division by zero
...

Commodore 64 Assembler, 9 Bytes (6502/KickAssembler)

Turns out the solution I came up with is pretty much exactly like insert_name_here's 9 byte solution for Apple II+: https://codegolf.stackexchange.com/a/103322/128511 The only differences being the memory address of the ROM routine for printing out the number, and where to branch to halt/crash when the count reaches zero. I suppose this makes a lot of sense, as both machines run on 6502, and Applesoft BASIC and Commodore BASIC are both just variations of Microsoft BASIC. I wasn't aware of the similarities in their BASICs until now. Live and learn. 😁 Anyway, on to the answer.

Code

* = $b1
dec $b6
beq $76
ldx #11
jmp $bdcf

Explanation

JavaScript, 44 bytes

function* f(n=11){for(;--n;yield n);throw''}

p=f()
console.log(p.next().value)
console.log(p.next().value)
console.log(p.next().value)
console.log(p.next().value)
console.log(p.next().value)
console.log(p.next().value)
console.log(p.next().value)
console.log(p.next().value)
console.log(p.next().value)
console.log(p.next().value)
console.log(p.next().value)

Ruby, 94 87 84 61 59 bytes

j=File.open(?a,"a+");1/(i=j.readlines.size-14);p -i;j.puts

Please leave suggestions below.

Thanks @ConorO'Brien for the ideas (some shamelessly ripped off from his answer).