RE: Support for comments /* ... */
(02-24-2017 05:36 PM)compsystems Wrote: Hello
One way to better visualize a code, where a function has several arguments (for example input( arg1, arg2, ..., argn), is to write each argument in a separate line
input
(
arg1,
arg2,
...,
argn
);
But if you want to comment with // the code generates error, because the comment covers until the end of the sentence (; ), for this we need comments of the form / * * /
PHP Code:
export testInputList() begin local a, b, c; local resetVAL_a, resetVAL_b, resetVAL_c; local initVAL_a, initVAL_b, initVAL_c;
initVAL_a:={1}; initVAL_b:={2}; initVAL_c:={3}; resetVAL_a:={}; resetVAL_b:={}; resetVAL_c:={}; local ObjectType_AllAllowed := -1; local ObjectType_Real := 0; local ObjectType_Integer := 1; local ObjectType_String := 2; local ObjectType_Complex := 3; local ObjectType_Matrix := 4; local ObjectType_List := 6; local ObjectType_Function := 8; local ObjectType_Unit := 9; local ObjectType_CAS := 14;
local ObjectType := ObjectType_List; local title;
case if ObjectType == -1 then title:="Type Allow: "+"Alls" end; if ObjectType == 0 then title:="Type Allow: "+"Real" end; if ObjectType == 1 then title:="Type Allow: "+"Integer" end; if ObjectType == 2 then title:="Type Allow: "+"String" end; if ObjectType == 3 then title:="Type Allow: "+"Complex" end; if ObjectType == 4 then title:="Type Allow: "+"Matrix" end; if ObjectType == 6 then title:="Type Allow: "+"List" end; if ObjectType == 8 then title:="Type Allow: "+"Function" end; if ObjectType == 9 then title:="Type Allow: "+"Unit" end; if ObjectType == 14 then title:="Type Allow: "+"CAS" end; default title:="Type Allow: "+"?" end;
local ok := 1; local cancel := 0; local keyPressedOnMenu := 0; keyPressedOnMenu := input ( { {a, [ObjectType] }, {b, [ObjectType] }, {c, [ObjectType] }
}, title, { "label_a", "label_b","label_c" }, { "help_a", "help_b", "help_c" }, { resetVAL_a, resetVAL_b, resetVAL_c }, { initVAL_a, initVAL_b, initVAL_c } ); if keyPressedOnMenu == ok then return ({a, b, c}); else return "Done"; end; end;
Successful compilation
But not with
PHP Code:
INPUT ( ... { "help_a", "help_b", "help_c" }, //{ resetVAL_a, resetVAL_b, resetVAL_c }, //{ initVAL_a, initVAL_b, initVAL_c } ); // end input
The problem would be solved in the following way
PHP Code:
INPUT ( ... { "help_a", "help_b", "help_c" }, /* { resetVAL_a, resetVAL_b, resetVAL_c }, */ /* { initVAL_a, initVAL_b, initVAL_c } */ );
Would the following be equivalent?
PHP Code:
INPUT ( ... { "help_a", "help_b", "help_c" }, /* { resetVAL_a, resetVAL_b, resetVAL_c }, { initVAL_a, initVAL_b, initVAL_c } */ );
Tom L
Cui bono?
|