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

Branching Statements #12

Open
SK1Y101 opened this issue Jul 7, 2021 · 1 comment
Open

Branching Statements #12

SK1Y101 opened this issue Jul 7, 2021 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@SK1Y101
Copy link
Member

SK1Y101 commented Jul 7, 2021

If statement

A singular if is the simplest branching statement, and decides whether a chunk of code will be executed or not, depending on some condition.

Python:

if x == 0:
  print("x was zero")

Verboscript:

if x is equal to zero, then do the following:
  show "x" was zero.

Else statement

if the if was not true, then the else is triggered:

Python:

if x == 0:
  print("x was zero")
else:
  print("x was not zero")

Verboscript:

if x is equal to zero, then do the following:
  show "x" was zero.
otherwise, do this:
  show "x" was not zero.
if x is equal to zero, then do the following:
  show "x" was zero.
else, do this:
  show "x" was not zero.

both otherwise and else could be applicable.

@SK1Y101 SK1Y101 added enhancement New feature or request good first issue Good for newcomers labels Jul 7, 2021
@SK1Y101 SK1Y101 added this to the Full Language Syntax milestone Jul 7, 2021
@SK1Y101
Copy link
Member Author

SK1Y101 commented Jul 7, 2021

Potential for the if-elif-else block:

Python:

if x == 0:
  print("x was zero")
elif x == 2:
  print("x was two")
elif x == 7:
  print("x was seven")
elif x == 354:
  print("x was three hundred and fifty four")
else:
  print("x was not any of the numbers listed")

Verboscript could instead make use of a modified version of the else command decided above:

if x is equal to zero, then do the following:
  show "x" was zero.
else, if x is equal to two, then do this:
  show "x" was two.
if x is instead equal to seven, then do this:
  show "x" was seven.
alternatively, if x is equal to three hundred and fifty four, then do this:
  show "x" was three hundred and fifty four.
otherwise, do this:
  show "x" was not any of the numbers listed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant