built-in-functions
which users can use anywhere in their ftd document.-- <return-type> <function-name>(<arg-1-name>, <arg-2-name>, ...): <arg-1-type> <arg-1-name>: <optional-default-value> <arg-2-type> <arg-2-name>: <optional-default-value> ... <function-body>
add()
function is defined below which takes two integer as arguments and returns the added value.add()
function-- integer add(a, b): integer a: integer b: a + b
$
.-- integer add(a, b): integer a: integer b: a + b -- ftd.column: spacing.fixed.px: 10 color: $inherited.colors.text -- ftd.text: Adding 35 and 83 -- ftd.integer: $add(a=35, b=83) -- end: ftd.column
This function will clamp the value between 0 and max
.
[0,max]
given max > 0
.regular-clamp()
-- integer $num: 0 -- display-integer: $num $on-click$: $regular-clamp($a = $num, by = 1, max = 6) -- void regular-clamp(a,by,max): integer $a: integer by: integer max: a = (a + by) % (max + 1)
This function will clamp the value between min
and max
.
[min,max]
given max > min
.clamp_with_limits()
-- integer $n: 1 -- display-integer: $n $on-click$: $clamp_with_limits($a = $n, by = 1, min = 1, max = 6) -- void clamp_with_limits(a,by,min,max): integer $a: integer by: 1 integer min: 0 integer max: 5 a = (((a - min) + by) % (max + 1 - min)) + min
Have a question or need help?
Visit our GitHub Q&A discussion to get answers and subscribe to it to stay tuned.
Join our Discord channel and share your thoughts, suggestion, question etc.
Connect with our community!We welcome you to join our Discord community today.
We are trying to create the language for human beings and we do not believe it would be possible without your support. We would love to hear from you.