I cannot understand the behavior of this simple code:
(defun foo (str bool)
(interactive
(list (read-string "Some text: ")
(y-or-n-p "Yes or no? ")))
(message "%s is first" str)
(if bool (message "%s is in if" str)))
When I call it with M-x foo
, it prompts for a string input -- which I give as this
-- then Yes or no?
Good so far. But if I type in n
, it prints out this is first
. But if I choose y
, it seems to jump past the (message "%s is first" str)
line and enter the if
, which is true (not nil), printing this is in f
. Why is the line before if...
being skipped if I choose y
?