put everything in a main function
This commit is contained in:
parent
80eb75e891
commit
3e0bfe973e
10 changed files with 35 additions and 14 deletions
|
@ -1 +1,3 @@
|
|||
a = 1312; # Error on line 1 col 2: Unbound variable "a".
|
||||
void main () {
|
||||
a = 1312; # Error on line 2 col 6: Unbound variable "a".
|
||||
}
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
int a = 1312;
|
||||
void main () {
|
||||
int a = 1312;
|
||||
}
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
bool a = true;
|
||||
void main () {
|
||||
bool a = true;
|
||||
}
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
foo = 1312; # Error on line 1 col 4: Unbound variable "foo".
|
||||
void main () {
|
||||
foo = 1312; # Error on line 2 col 8: Unbound variable "foo".
|
||||
}
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
int foo = bar; # Error on line 1 col 10: Unbound variable "bar".
|
||||
void main () {
|
||||
int foo = bar; # Error on line 2 col 14: Unbound variable "bar".
|
||||
}
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
int foo;
|
||||
int bar = foo; # Warning on line 2 col 10: Unassigned variable "foo".
|
||||
void main () {
|
||||
int foo;
|
||||
int bar = foo; # Warning on line 3 col 14: Unassigned variable "foo".
|
||||
}
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
int foo = true; # Error on line 1 col 10: Expected int but given bool.
|
||||
void main () {
|
||||
int foo = true; # Error on line 2 col 14: Expected int but given bool.
|
||||
}
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
int foo = 1312;
|
||||
bool bar = foo; # Error on line 2 col 11: Expected bool but given int.
|
||||
void main () {
|
||||
int foo = 1312;
|
||||
bool bar = foo; # Error on line 3 col 15: Expected bool but given int.
|
||||
}
|
||||
|
|
|
@ -1,2 +1,5 @@
|
|||
int vie = 42;
|
||||
return vie;
|
||||
int main () {
|
||||
int vie = 42;
|
||||
|
||||
return vie;
|
||||
}
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
int res = 13 * 100 + 20 - 8;
|
||||
res = res * 2 / 2;
|
||||
void main () {
|
||||
int res = 13 * 100 + 20 - 8;
|
||||
res = res * 2 / 2;
|
||||
}
|
||||
|
|
Reference in a new issue