If statement help needed! Please help!

Hi guys, I’ve been trying to make a language based on Python called Pulse (please tell me if this name is taken). I’ve done a number of commands but I’m stuck at the if statement, I just can’t get it to work.
Repl link:

def ifcon(conif,runif,conelif,runelif,runelse):
  if conif:
  elif conelif:
def ifcone(conifelif,runifelif,conifelif2,runifelif2):
  if conifelif:
  elif conifelif2:

Processing: Screenshot_20230625_150632_Replit.jpg…

If you guys want to collaborate with me, privately message me.

What do you expect as the parameters to you functions? Are they callable, if so, you’ll need to actually call them with ().

1 Like

Soo… what do you suggest I do?
I tried it and it would ignore the condition, it would go on to the code that would run.

Please give some context as to how you are trying to use this function and what it is supposed to do. At the moment it appears to do nothing.

1 Like

It is supposed to run an if statement.
conif is the condition for the if statement
runif is the code that will be run if the condition is met
coneif is like conif, but for elif
runelif is like conif, but for elif
runelse islike runif, but for else

The second version is an altered version of the first.

1 Like

so is the code passed in lambdas? Please show an example your function being used.

1 Like

@NateDhaliwal I know this is off topic but how will you release the project later, will it have the Pulse.py for everyone to see or not? Will it be a template? I would like to know for possible future reference.

1 Like

Sorry, what is lambadas?

I will be changing a few things. I’m still sorting that bit.

@NateDhaliwal Python Lambda

1 Like

If you want @SalladShooter , you can collab with me.

@NateDhaliwal sure, invite me to the Repl and I’ll help out.

I have invited you already.

Hmm… it was not very clear. I would only like to know, can my code work?

@NateDhaliwal open the chat in the Repl I’ll talk to you there.

@NateDhaliwal was my solution the solution to the problem (inviting me and helping you) the full solution, or do you need more help?

1 Like

@NateDhaliwal I got it working. When you are using the function in front of the code you want to run if the conditions are correct you’ll put lambda:

ifconelse(x == 5, lambda: display("It is 5"), x == 7,lambda: display("It is 7"), lambda: display("It is not 5 or 7"))

This is the updated code in pulse:

def ifconelse(conif,runif,conelif,runelif,runelse):
  if conif == True:
  elif conelif == True:

Edit: I also made the colors better using a dictionary (you now use all caps color names and quotes, ex: ‘BLUE’ or “BLUE”)

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.