We created a simple hello world message the last exercise. We could have done this in HTML as well. Where we differ from HTML is, if you wanted to add a variable or define data, you would have to switch to JavaScript. But we can do everything in FTD itself.
Unlike JavaScript and Python and other dynamically typed languages, FTD is statically typed language. All variables in FTD have a type, which must be specified when the variable is constructed.
-- boolean foo: true
boolean
variable named foo
, with an initial value of true
. A boolean variable can have only two values, true
or false
, and it must be initialised with a value.if
condition on a node to conditionally show a UI node:$open
syntax-- ftd.text: open is true if: $open
open
is true only then text “open is true” would be visible.index.ftd
fileboolean.ftd
/boolean/
you will see an error. This is because we have not yet defined a variable that we are trying to use. boolean.ftd is buggy! View the boolean.ftd
and follow the instructions there to create a new variable.You have learnt how to define a boolean variable and use to control the UI.
Move to learning about numbers and stringsor back to the workshop.