Skip to content
Discussion options

You must be logged in to vote

@uvtc How about using prompt with return (I think this was another of @yumaikas' ideas) in the following manner:

(defn main
  [args]
  (while true
    (prompt :top
    
      (def num (scan-number
                 (get-user-input "Enter a num: ")))

      (when (< 100 num)
        (print "Too high. Keep it under 100.")
        (return :top))

      (print "Ok, " num))))

FWIW, I got the following sort of output in one trial:

$ janet continue.janet 
Enter a num: 2
Ok, 2
Enter a num: 101
Too high. Keep it under 100.
Enter a num: 

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by uvtc
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants