Millisecond Forums

Evaluate an expression in a ?

https://forums.millisecond.com/Topic17031.aspx

By writekristin - 8/30/2015

I am creating a <page> for my post instructions that will report on how the user performed, however depending on the performance, I want it to say different things.  Is there a way to evaluate a value in the <page> and have it display different wording?  Alternatively, I can create two different pages, but can I then do branching in the postinstructions of the <block>?

Thanks!
By Dave - 8/30/2015

Yes, you can embed expressions or create inline expressions in a <page> as usual.

<expressions>
/ pagetext = if (trial.mytrial.correct) "You won!" else "You lost!"
</expressions>

<block myblock>
/ postinstructions = (end)
/ trials = [1=mytrial]
</block>

<trial mytrial>
/ validresponse = ("e", "i")
/ correctresponse = ("e")
</trial>

<page end>
^<% expressions.pagetext %>
^Goodbye!
</page>
By writekristin - 8/31/2015

thank you!