3 ms·
>(no err != nil checks), How does that work in practice? Example please.
by fuzztester 3y ago
>(no err != nil checks),
How does that work in practice? Example please.
- amedvednikov 3y agoV uses Result types for handling errors, and the developer must handle them by propagating the error or breaking/returning or panicing. For example: // os.v fn open(path string) !File {} // main.v file := os.open('out.txt') or { panic('failed to open: $err') } file := os.open('out.txt') or { return } file := os.open('out.txt')! // propagate the error if file := os.open('out.txt') {} // alternative scoped syntax
- deleted 3y ago[deleted]
- fuzztester 3y agoThanks. V syntax looks somewhat clear.