Skip to content

Commit

Permalink
Concatenation tip
Browse files Browse the repository at this point in the history
  • Loading branch information
SingularityT3 committed Apr 11, 2024
1 parent 03a48d7 commit 4a02145
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/nodes/eval/arithmetic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,10 @@ std::unique_ptr<NodeResult> ArithmeticOperationNode::evaluate(PSC::Context &ctx)
if ((leftRes->type != PSC::DataType::INTEGER && leftRes->type != PSC::DataType::REAL)
|| (rightRes->type != PSC::DataType::INTEGER && rightRes->type != PSC::DataType::REAL)
) {
throw PSC::InvalidUsageError(token, ctx, "'" + op + "' operator, operands must be of type Integer or Real");
if (leftRes->type == PSC::DataType::STRING || rightRes->type == PSC::DataType::STRING)
throw PSC::InvalidUsageError(token, ctx, "'" + op + "' operator, operands must be of type Integer or Real.\nUse the '&' operator if you want to concatenate.");
else
throw PSC::InvalidUsageError(token, ctx, "'" + op + "' operator, operands must be of type Integer or Real");
}

const PSC::Number &leftNum = leftRes->get<PSC::Number>();
Expand Down

0 comments on commit 4a02145

Please sign in to comment.