Oxygen Basic
Programming => Bugs & Feature Requests => Topic started by: Peter on February 12, 2011, 03:14:22 PM
-
Deleted
-
Personally I see no advantage in using multiple statements on a single line. A second statement after a IF/THEN is cruel. >:(
ScriptBasic gains a lot of it's speed as an interpreter due to the single statement per line rule. Much easier to compile into pcode.
-
Oxygen has very flexible parsing rules - a great challenge to implement but it gives the programmer great flexibility of expression and makes code porting easier. You can get the code working before imposing the preferred style.
Personally I use colons when the statements go together naturally as a semantic unit. But I think we can all agree that clarity is paramount.
Just to show off, These 2 extreme variations do the same thing :)
10 a=100 : b=0 : tx="" : iF a=10 then b=a : tx = "HALLO" else tx="GOODBYE" : b=a*2
20 print tx + " " + b
long a=100;
long b;
string tx;
if (a==10) {
b=a;
tx = "HALLO";
} else {
tx="GOODBYE";
b=a*2;
};
print tx + " " + b;
Charles
-
I think Assembler is good too but enforcing one instruction per line
m
a
k
e
s
i
t
h
a
r
d
t
o
r
e
a
d
;D
therefore Oxygen supports:
mov eax,a : add eax,4 : mov b,eax
Charles
-
I was referring to Basic and interpreters specifically.