Vely logo install | documentation | examples | articles | changelog
16.6.0 released on Mar 08, 2023 | articles updated on Mar 20, 2023

Inline code


Purpose: Inline Vely code in string statements.

<<vely code>>
You can write Vely code within other Vely statements that build strings, whether for output (output_statement) or to build other strings (write-string), by using << and >> delimiters. There is no need for white space between the delimiters and Vely code, i.e. you could either write
<<p-web my_string>>
or
<<  p-web my_string  >>
to the same effect.

Examples

query-result statement displays the result of a query, and in the following code it's used to display results on the same line as other output (i.e. as inline):
run-query
   @<tr>
   @    <td>
   @        First name is << query-result  firstName >>
   @    </td>
   @    <td>
   @        Last name is << query-result# employees, lastName >>
   @    </td>
   @</tr>
end-query
In the code below, "some_function()" is a C function that uses Vely code to output some text, and it's used inline to output "Hello world":
@Hello <<.some_function();>>
(note the usage of dot statement to use any C expression, and finishing with semi-colon as a C statement). Function "some_function()" would simply output "world":
void some_function()
{
    @world
}
A write-string can be built with other Vely statements inlined, in this case we print the value of another string, resulting in "There is 42 minutes left!":
char * mins="42";
(( define my_string
There is <<p-out mins>> minutes left!
))

See also

Language ( dot   inline_code   statement_APIs   syntax_highlighting   unused-var  )  SEE ALL (documentation)


Copyright (c) 2017-2023 DaSoftver LLC. Vely is a trademark of Dasoftver LLC. The software and information herein are provided "AS IS" and without any warranties or guarantees of any kind. Vely elephant logo (c) 2022 DaSoftver LLC. This web page is licensed under CC-BY-SA-4.0. Contact email vely@vely.dev.