Skip to content

fix: turn statements/expressions example into an actual exercise#584

Open
Blaze2216 wants to merge 1 commit into
sunface:masterfrom
Blaze2216:patch-1
Open

fix: turn statements/expressions example into an actual exercise#584
Blaze2216 wants to merge 1 commit into
sunface:masterfrom
Blaze2216:patch-1

Conversation

@Blaze2216

Copy link
Copy Markdown

Converts the statements-expressions example into an active exercise.

Currently, the code passes successfully without any modification from the user, which defeats the purpose of the exercise. By adding a semicolon to the x + y expression inside the sum function, it turns into a statement. This introduces a mismatched types compilation error, forcing the user to understand the difference between expressions and statements in Rust to fix it. Changes

  • Added a semicolon to x + y in fn sum.
  • Updated the code state to require user intervention to pass the assertion.

Converts the statements-expressions example into an active exercise.

Currently, the code passes successfully without any modification from the user, which defeats the purpose of the exercise. By adding a semicolon to the x + y expression inside the sum function, it turns into a statement. This introduces a mismatched types compilation error, forcing the user to understand the difference between expressions and statements in Rust to fix it.
Changes
- Added a semicolon to x + y in fn sum.
- Updated the code state to require user intervention to pass the assertion.
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