Until now, your CSML code might have looked something like this:
say Question( "What is your favorite car?", buttons=[ Button("Ferrari") as ferrari, Button("Lamborghini") as lambo, Button("Mercedes") as merc, Button("BMW") as bmw, Button("Lada") as lada ] ) hold if (event match ferrari) remember car = "Ferrari" else if (event match lambo) remember car = "Lamborghini" else if (event match merc) remember car = "Mercedes" else if (event match bmw) remember car = "BMW" else if (event match lada) remember car = "Lada" else say "Wrong input"
which is both repetitive and unelegant.
We just introduced a new event method,
.match(), that takes any number of arguments and returns the first one that does match (or
Null if there is none). This makes the same code very much more readable:
do matched = event.match(ferrari, lambo, merc, bmw, lada) if (matched) remember car = matched.title else say "Wrong input"
We now recommend that you use this new feature instead of the old "match" keyword, but of course the old keywords stays 😉