Reputation: 22255
I'm reviewing an old ASP classic code originally written by another developer. And I keep seeing the <%=
tags. Can someone tell me what is it called? And what does it do?
PS. Googling <%=
alone doesn't seem to work.
Upvotes: 1
Views: 222
Reputation: 66389
This is officially called inline expression code render block as described here:
Code render blocks define inline code or inline expressions that execute when the page is rendered. There are two styles of code render blocks: inline code and inline expressions. Use inline code to define self-contained lines or blocks of code. Use inline expressions as a shortcut for calling the Write method.
As for what it does, as the other answer already describes it's a shortcut for calling the Response.Write method.
As for Google, it omits non-letters so it's not possible as far as I know to search for "<%".
Upvotes: 2
Reputation: 218808
Think of it like shorthand for Response.Write()
(or shorthand for something like echo
in PHP). This:
<div>
<% Response.Write(someValue) %>
</div>
is essentially equivalent to this:
<div>
<%= someValue %>
</div>
The =
tells the interpreter to just emit that value to the output.
Upvotes: 5