Marist-CMPT331-TOPL / adder

Adder is a small but usable subset of the Python language. It is named for the Blackadder comedy series, much as the Python language is named for Monty Python.
MIT License
0 stars 2 forks source link

Take 2 of if else stmt #66

Closed MaxEnglish closed 1 year ago

MaxEnglish commented 1 year ago

-Parser is yelling at me a lot and I'm not sure what's the matter with the code I have written there. -I remember you said that I'd only need to use resultOfStmts once per function, but I'm not sure how to do that so I just did what I was comfortable with. -I realize that you need an else stmt for every if-then-else in Haskell but for ifstmt and ifelif stmt I don't want an else. I believe that's why it's throwing an error for me. How can I circumvent this?

Tientuine commented 1 year ago

-Parser is yelling at me a lot and I'm not sure what's the matter with the code I have written there. -I remember you said that I'd only need to use resultOfStmts once per function, but I'm not sure how to do that so I just did what I was comfortable with. -I realize that you need an else stmt for every if-then-else in Haskell but for ifstmt and ifelif stmt I don't want an else. I believe that's why it's throwing an error for me. How can I circumvent this?

I'll post comments on the files themselves shortly, but I think I may not have explained clearly enough about resultOfStmts. When I explained it early, it was in response to something you asked and I wanted to make sure that you didn't try to call the function twice (different from having it appear in the code twice). I did not mean that you would only write the function call once, but rather than it would only be called once. For example, consider

    if test x then f y else f z

Here the function f is called only once, even though it appears twice in the code.