Curriculum Foundations Functions & multi-return exercise 4 · mcq
Functions & multi-return
Exercise 3 covered the (T, error) return-tuple signature. To put a
*value* into the error half of that tuple, Go uses a tiny stdlib
helper. Which one constructs a new error from a string?
TypeScript reference
About this theme
Functions look familiar — func name(args) returnType { ... } — with one big new idea: multiple return values. Go functions can return a tuple, and the convention for "this might fail" is to return (result, error). We'll meet error properly in a later module, but the *shape* arrives here.