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

Enable addition to undefined variables #67

Merged
merged 1 commit into from
Sep 4, 2023

Conversation

buty4649
Copy link
Owner

@buty4649 buty4649 commented Sep 4, 2023

関連: #37

未定義の変数(具体的にはnil)に対して加算できるようにします。
これにより事前に変数を初期化する必要がなくなります。

# 変更前
$ echo -e '1\n2\n3\n' | rf -q 's||=0; s+=_1.to_i; at_exit { puts s }'

# 変更後
$ echo -e '1\n2\n3\n' | rf -q 's+=_1.to_i; at_exit { puts s }'

IntegerとFloatには -, *, / があるが、Stringにはないので今のところ+のサポートだけにする。

@buty4649 buty4649 merged commit 67fef13 into main Sep 4, 2023
8 checks passed
@buty4649 buty4649 deleted the allow-undefined-var-assignment branch September 4, 2023 11:52
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