About: "if","else","for","while","switch" etc...
X64E opened this issue · comments
Why operators:
if, else, for, while, switch
calls as structure?
colobot-data/help/generic/po/generic.pot
Lines 537 to 544 in 21a45c0
And i thing "if" is compare operator. Choiсe operator is "switch"
Yeah, "structure" seems like a weird word to use here.
if
is a conditional statementelse
is a part of theif
statement, maybe merge them in one line?if-else
switch
is a switch statement (duh!), which doesn't tell much. Maybe "multiway branch"?case
merge withswitch
:switch-case
default
I guess it also needs to be merged withswitch
:switch-case-default
. They all link to the same page anyway.for
,while
anddo
are all loop statements. Do not merge them together, just repeat the "loop statement" description.
And i thing "if" is compare operator. Choiсe operator is "switch"
These are not operators (like +
, *
, ++
, or ?:
), they are statements. In some languages, they may also be expressions (they return a value, f.e. Java switch expression), but in CBOT they are just statements.
I dont know why, but in any Russian sources "statement" is translated as "оператор" = "operator". May be this is translation error. https://docs.microsoft.com/ru-ru/cpp/cpp/if-else-statement-cpp?view=msvc-170 However, it does not matter.
About combining keywords into one line, I think it's not worth to doing this. For students, better if they should be visible all in one list.
What if we use "keyword" word?
For example:
Main constructions in the CBOT language: (header)
if Keyword for conditional statement
else Keyword for else conditional statement
switch Keyword for multiple choice statement
...
for Keyword for loop statement
...
break Keyword for exit from loop or switch case
continue Keyword for run new iteration of loop
return Keyword for exit from a function
sizeof Keyword for get size of an array
"Main constructions" i.e. - branching (if,switch) and cycles(for,while,do-while,repeat).
I would also like to keep them in separate lines.
"Keyword" seems ok to use here, albeit it is a bit generic. On the other hand, beginning every description with "Keyword for" seems a little silly to me as it doesn't convey any new or useful information. This repetition indicates to me that it could be dropped completely and we should leave only the part after "for".
if conditional statement
else alternative conditional statement
switch multiple choice statement
...
for loop statement
...
break exit from a loop or a switch case
continue run next iteration of a loop unconditionally
return exit from a function
sizeof get size of an array
This looks much better IMHO. The goal is to have better one-line descriptions for each keyword and remove the misleading "structure" word.
I will clarify. "sizeof" and "new" is really unary operators http://candcplusplus.com/c-operator-precedence-and-associativity as "+","&&",">" etc.