Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for conditionals like "else if" and "else" #60

Open
Aarthi-V opened this issue Apr 15, 2019 · 10 comments
Open

Support for conditionals like "else if" and "else" #60

Aarthi-V opened this issue Apr 15, 2019 · 10 comments

Comments

@Aarthi-V
Copy link

I tried the following in the IDE :
if 2 = 2 : print yes
else print no
And the output was :
yes
no
I think there should be an error message displayed for the use of "else".

Currently the code supports only "if" but not "else if" or "else". I think we should add these functionalities as well.

@Abdur-rahmaanJ
Copy link
Owner

hum ok

@anirudnits
Copy link

Is anybody working on this? otherwise I would to like to work on this.

@tthuma1
Copy link
Collaborator

tthuma1 commented Jun 17, 2019

It's not taken by anyone yet. You're free to work on it!

@anirudnits
Copy link

Thanks

@anirudnits
Copy link

I just had a little question about the file gbsymbols/symbols.py. I get that in this file you defined all the keywords and the symbols for the language( in a key-value pair ), but why do so in a class? couldn't the same thing be done with a dictionary? Just wanted to know if there any specific reasons on why the former is more efficient/preferred than the later. Thanks

@Abdur-rahmaanJ
Copy link
Owner

@anirudnits dot notation better

@anirudnits
Copy link

Does nested if-elif-else conditionals make sense for greenBerry? I am asking because its a one-sentence language and if nested conditionals are allowed then it may become messy.
I am trying to implement the simple if-elif-else without considering nesting. do I need to take that into account? Thanks

@Abdur-rahmaanJ
Copy link
Owner

@anirudnits try a without nesting

@anirudnits
Copy link

anirudnits commented Aug 18, 2019

@Abdur-rahmaanJ I am sort of done with integrating elif and else statements. I have implemented the following in this way:
ELIF: elif 2 = 3: print elif works
ELSE: else print else also works

Notice that I intentionally left out the colon for the else statement. I just thought that would be more intuitive. Any thoughts?

@Abdur-rahmaanJ
Copy link
Owner

@anirudnits works fine!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants