amritrout / ArcaneScript

ArcaneScript is a custom programming language developed to explore language design and interpretation. This project includes the development of both the ArcaneScript language and its online Runner.
https://arcanescript.netlify.app/
6 stars 3 forks source link

Lack of Support for else if in ArcaneScript Conditional Statements #6

Open thecloudcode opened 1 week ago

thecloudcode commented 1 week ago

Description:

ArcaneScript currently does not support the else if construct within conditional statements, making it impossible to create an if-else if-else ladder. This limitation restricts developers from implementing multiple condition checks in their scripts, which is a fundamental feature of most programming languages.

Steps to Reproduce:

  1. Write the following ArcaneScript code:
    v = 7;
    if(v == 6) {
       println "If Works";
    } else if(v == 7) {
       println "Else if works";
    } else {
       println "Else works";
    }
  2. Attempt to run the code.
  3. Observe that the else if condition does not work, and the code either produces an error or skips the else if block entirely.

Expected Behavior:

The script should check the conditions in sequence:

Actual Behavior:

The else if block is not recognized, causing the conditional statement to either result in an error or default directly to the else block, ignoring any intermediate conditions.

Suggested Solution:

Priority: High

Conditional ladders are essential for implementing complex logic in scripts, and the lack of this feature limits the functionality of ArcaneScript significantly.

thecloudcode commented 1 week ago

Hi, @amritrout , would love to work on this issue as well. Please do assign it to me.

thecloudcode commented 23 hours ago

@amritrout Hi Amrit, kindly merge the PR, if it's fine.