diff --git a/langkama/ai.nkm b/langkama/ai.nkm index e28153e..2e692df 100644 --- a/langkama/ai.nkm +++ b/langkama/ai.nkm @@ -11,16 +11,4 @@ big if true (show) { loncina("result: " + bait(z)); } sike { loncina("calculated!"); -} - -let me cook test() { - big if true (W) { - reda 1; - } sike { - reda 2; - } - - loncina("should NOT execute"); -} - -bs reda test(); Script output should be 1 \ No newline at end of file +} \ No newline at end of file diff --git a/test/conditions.test.js b/test/conditions.test.js index 6e43804..f1e27cf 100644 --- a/test/conditions.test.js +++ b/test/conditions.test.js @@ -96,6 +96,31 @@ describe('Conditions', () => { }) .interpret(code); }); + + test('If else statement 3', done => { + const code = ` + a sa7 hear me out age is 21; + a sa7 hear me out entryAge is 18; + hear me out value is L; + + big if true (age = entryAge) { + value is 50; + } jk (age > entryAge) { + value is 100; + } sike { + value is 0; + } + + reda value; + `; + + compiler + .on(LangKamaEvent.Success, result => { + expect(result.value).toBe(100); + done(); + }) + .interpret(code); + }); }); describe('Condition errors', () => {