I notice that you code snippets are very wrong when it comes to casing (notice the color of things).
Why don't you copy/paste the code from your program so that it is at least syntactically correct?
Anyways, there is no "simple and neat" solution to that problem. I will however suggest that you create a single message to write in the "note", for example like this:
Code: Select all
S = outputStream_string::new(),
S:writef("% may suffer from: ", Patient),
Found = varM::new(false),
foreach hypothesis(Patient, Disease) do
if true = Found:value then S:write(", ") end if,
Found:value := true,
if false = Found:value then S:write("(no matching diagnosis)") end if,
Msg = S:getString(),
is an outputStream that collects the written stuff into a string. The varM (Found
) is a mutable variable which is set to true when the first Disease
The flag is both used to deside whether there should be a a comma in front of the disease, and to deside whether to write "(no matching diagnosis)".