Skip to content

Commit 4163a51

Browse files
author
Matthilde
committed
h
1 parent 0ec2cd4 commit 4163a51

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

engine.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,16 @@ int ExecuteLine(std::string line, int pptr) {
110110
intvars[toupper(o.at(0)) - 'A'] = evalString(oa, intvars, false);
111111
return 0;
112112
}
113+
} else if (starts_with(line, "=$ ")) {
114+
string o = line.erase(0, 3);
115+
string oa = line.erase(0, 1);
116+
if (o == "" || !isalpha(o.at(0)) || oa == "") {
117+
cout << "!SYNTAX ERROR" << endl;
118+
return -1;
119+
} else {
120+
stringvars[toupper(o.at(0)) - 'A'] = evalStringAddition(oa, stringvars);
121+
return 0;
122+
}
113123
} else if (starts_with(line, "G ")) {
114124
if (pptr == -1) {
115125
cout << "!PROGRAM ERROR" << endl;
@@ -143,9 +153,9 @@ int ExecuteLine(std::string line, int pptr) {
143153
if (a == -1)
144154
return -1;
145155
else
146-
return 0;
156+
return a;
147157
} else {
148-
return -1;
158+
return 0;
149159
}
150160
} else if (starts_with(line, "I$ ")) {
151161
string o = line.erase(0, 3);

libs/stringcond.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ bool evalIntCondition(string condition, int* vars) {
149149
else
150150
return false;
151151
} else if (op == '<') {
152-
if (evalString(expA, vars, false) > evalString(expB, vars, false))
152+
if (evalString(expA, vars, false) < evalString(expB, vars, false))
153153
return true;
154154
else
155155
return false;

0 commit comments

Comments
 (0)