We talk about the Scheme operator call-with-current-continuation, henceforth called call/cc for brevity. When we call (call/cc f) then f is passed a continuation cont as an argument. When f or some nest function calls (cont arg) then the computation resumes as if the call/cc call returned arg.

Here’s an example of continuation being used to exit a nested function:

; Return the first element for which wanted? returns true
(define (search wanted? lst)
	(call/cc
		(lambda (return)
			(for-each (lambda (element)
						(if (wanted? element) (return element)))
						lst))
			#f)))

Continutations can also be used in weird ways.

(define return #f)
 
(+ 1 (call/cc 
		(lambda (cont)
			(set! return cont)
			1)))

return is now set to the continuation. If we now call (return 22), it returns 23!!

We can also use these continuations to implement coroutines which can yield computation to other coroutines