1

Does elisp have a way to jump to (goto) labels in the code, ala common lisp's go?

 (tagbody (setq val 2) (go lp) (incf val 3) lp (incf val 4)) => NIL val => 6 

PS: This is a question about control flow, not jumping to locations in files.

2
  • The cl-lib library offers cl-tagbody (and, I presume, friends), which offers some of the common lisp primitives to do this sort of thing. Commented Sep 22, 2021 at 16:03
  • @Dan Thanks, that's the answer. Commented Sep 22, 2021 at 16:06

1 Answer 1

4

It works exactly the same, we just need to use cl-tagbody instead.

(cl-tagbody (setq val 2) (go lp) (incf val 3) lp (incf val 4)) val 
6 

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.