This is down to changes that were made for new versions of ZPE.
input_validate (function f, string failure_message, [integer max_times]) ⇒ string
Runs a standard input validation algorithm that will wait for the user to enter a valid response. Using a lambda function or a function call, this method can use a custom validation tool. If the max_times parameter is set, the validation will run a maximum of that number of times before stopping and throwing an invalid input error.
The following examples demonstrate this function:
function check($x) if ($x == "password") return true else return false end if end function $v = input_validate(handle_of(check), "Incorrect password.") print($v)
The next example use input validation to check that a number is within a range:
$num = input_validate( function($x) $x = value($x) if ($x > 10 && $x < 100) return true else return false end if end function , "Number must be between 10 and 100.") print($num)
This example, submitted to me by one of the testers was based on something she had written before that inspired this and uses regexps:
$name = input_validate( function($x) if (string_matches($x, "[A-Z][a-z]+")) return true else return false end if end function , "Name must start with a capital and contain at least one lower case character after.") print($name)
S1s and S2s really enjoyed the lesson on cybercrime using the lesson on How to Rob A Bank on… https://t.co/MxjDYE2JFu
8 months ago
S2s doing really well in hardware test! Also really enjoying doing tests electronically rather than on paper.… https://t.co/ritdfcW6Mw
8 months ago
S1 and S2 pupils listing input and output devices and giving answers such as keyboard and mouse but there were also… https://t.co/dGxDkYqFxo
9 months ago