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

User actions #51

Merged
merged 10 commits into from
Jan 19, 2020
Merged

User actions #51

merged 10 commits into from
Jan 19, 2020

Conversation

BastianBlokland
Copy link
Owner

This pr adds user defined actions, meaning functions with side-effecs. Actions can call other actions and function but functions can only call other functions.

This also adds a few more build-in actions:

print(char)
printl(string) // Print line: like normal print(string) but outputs a newline after the string.
read() // Read: Returns a character from stdin.
readl() // Read line: Returns a string from stdin.
sleep(int) // Sleep for x milliseconds.

Example:

action greetEveryone()
  printl("Who are you?");
  name = readl();
  if name.length() == 0 -> 0
  else                  -> printl("Hi: " + name); sleep(1000); greetEveryone()

greetEveryone()

@BastianBlokland BastianBlokland self-assigned this Jan 19, 2020
@BastianBlokland BastianBlokland merged commit 0cdc0f9 into master Jan 19, 2020
@BastianBlokland BastianBlokland deleted the feature/user-actions branch January 19, 2020 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant