[plt-scheme] Conditions in web-templates
On Feb 7, Jay McCarthy wrote:
> Yes. Here is an example:
>
> if.html:
> @(if (@monkeys . > . @monkey-limit)
> @list{<p>There are too many monkeys!</p>}
> @(if (@monkeys . < . @monkey-minimum)
> @list{<p>There aren't enough monkeys!</p>}
> @list{<p>There are just enough monkeys!</p>}))
This is, BTW, the same as:
@(if (monkeys . > . monkey-limit)
@list{<p>There are too many monkeys!</p>}
(if (monkeys . < . monkey-minimum)
@list{<p>There aren't enough monkeys!</p>}
@list{<p>There are just enough monkeys!</p>}))
which is also the same as:
@(cond [(monkeys . > . monkey-limit)
@list{<p>There are too many monkeys!</p>}]
[(monkeys . < . monkey-minimum)
@list{<p>There aren't enough monkeys!</p>}]
[else @list{<p>There are just enough monkeys!</p>}])
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://www.barzilay.org/ Maze is Life!