Answers
- Using
%dw 2.0
in the script’s header because only major versions have to be provided, not minor versions. - Addition (
+
), subtraction (-
), prepend (>>
), and append (<<
) - It can be defined as follows:
var hello: String = "Hello World" --- hello
- It can be defined as follows:
fun sum(p1: Number, p2: Number): Number = p1 + p2 --- sum(1,2)
- Solution 1: Using if/else
fun order(original: String): String = do { var new: String = original[-1 to 0] --- if (original > new) original ++ " goes after " ++ new else if (original < new) original ++ " goes before " ++ new else original ++ " is a palindrome" } --- order("abc")
Solution 2: Using match/case
fun order(original: String): String = do { var new: String = original...