Statements

Statements in the exotool activity language perform actions. Unlike as with many other languages, there are no separators (e.g. "" to separate statements. statements are merely separated by whitespace (spaces tabs , lines or comments)

Exotool automaticall determines where specific statements execute (Client side or Server side) and groups statements in to code chunks representing major pieces of functionality that reside on the Server side. Together, these groups comprise the automatically generated Back-End API.

Whereas the ordering of statements is driven by source code, Exotool has the freedom to cause multiple statements to execute in parallel concurrently if possible and often does so, especially with code that is a mix of client-side and server-side functionality. )

Statement types

Format(s) Statement Type Examples
[variable reference] = [expression] Assignment statement. Sets the value of a variable. alpha = 5
item.price = price - discount
{
  [ statement]
  [statement]
}
Block. a sequence of statements. {
  alert("One")
  alert("two")
}
[function name]([argument], [argument],...) Internal function call (see Functions)
or call to user-defined macro (see Macros)
send_mail(to, subject, body, from, true )
alert("Success!")
[subroutine name]() User defined subroutine call (see Subroutines) mysubroutine()
JS<...>JS
JS<P...>JS
PHP<....>PHP
Statement defined using code in another language. see Explicit Client-Side Code (Javascript) and Explicit Server-Side Code (PHP) JS<console.log('test point 1');>JS
PHP< file_put_contents($myfile,time()."\n"); >PHP
if ([expression]) { [statements] }
if ([expression]) { [statements] } else { [statements] }
If statement. used to excute code or not execute it, based on the value of an expression if (a < 5) { alert("a is low!") }
else { alert("a is high") }
always [assignment]
always [expression] { [statements] }
Always statement. Used to cause a calculation and/or a set of operations to run whenever the value of an expression changes(see Always) always this_time_tomorrow = now() + (24*60*60)
ifonclient { [statements] }
ifonserver { [statements] }
Location-dependent statement (see ifonclient and ifonserver) ifonclient { JS<P new Promise(function(resolve,reject){ setTimeout(resolve,1000); }) >JS}
ifonserver { PHP< sleep(1); >PHP }
subroutine_def [name]() { [statements] } User subroutine definition (see Subroutines) subroutine_def alertTwice() { alert("One") alert("Two") }
defmacro [name]( [arguments] ) { [statements] } User macro definition. macros insert code as if it were duplicated (see Macros) defmacro timeAlert(message) { alert(concat( time, ": ", message)) }
declare_location [variable name] [client | server] Explicit location declaration. Used to force exotool to make sure that a variable is available either on the client or on the server. (see Explicit Location Declaration) declare_location myvar client
declare_location bigvar server