here is a possible solution:
---
title: "Inline code inside asis"
date: "`r Sys.Date()`"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r}
x <- 5
```
```{r, results='asis', echo=FALSE}
cat(paste0("The square is ", x^2, ".")) # should show up as 'The square is 25'
```
Did this solve your problem?
Viola