Tolga Yavuz
Tolga Yavuz

Reputation: 159

How to display string and variable in same thing?

I want the output to be like this: abc 15

The code:

(define b 15)
(if (> b 14)
(display "abc" b) 0)

Upvotes: 2

Views: 4509

Answers (1)

Greg Hendershott
Greg Hendershott

Reputation: 16260

There are many ways to do this.

You could use display more than once:

(when (> b 14)
  (display "abc ")
  (display b))

You could use printf:

(when (> b 14)
  (printf "abc ~a" b))

You could use at-expressions:

#lang at-exp racket

(when (> b 14)
  (display @~a{abc @b}))

Upvotes: 5

Related Questions