-
Notifications
You must be signed in to change notification settings - Fork 168
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
Add Kotlin I/O operations to fix #736 #762
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make tweak some of your examples and I'd be happy to merge this in!
(If you're doing Hacktoberfest, it should still count towards Hacktoberfest since it was opened in October)
web/thesauruses/kotlin/1.5/io.json
Outdated
"read_char": { | ||
"code": [ | ||
"val variable_name = readln()", | ||
"val first_char = variable_name[0]" | ||
], | ||
"comment": [ | ||
"First character can be read by accessing the first element of the string" | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally I've tried to keep the best practice that if you're writing code to replicate a function that doesn't exist, it shouldn't be in here. So if there's no built-in way to do that, it should probably be not-implemented: true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
web/thesauruses/kotlin/1.5/io.json
Outdated
"list_directory": { | ||
"code": [ | ||
"val dir = File(\".\")", | ||
"val files = dir.listFiles()", | ||
"file?.forEach { println(it.name) }" | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, as a reference tool, this should probably be just dir.listFiles
or like File(".").listFiles()
to show the form of how it works, not the full example.
(Similar to others below)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other changes:Read_directory_info has been changed to reflect unavailability as there are no in built operations. Stats are not present, and size or length must be calculated manually. Update_file has been changed to reflect unavailability as there are no set operations for this. Operations require modifying the lines of the file, and appending all plus newline char to the end of the list of strings. New: Old: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet! I'll merge this in if the checks pass. Thanks for contributing!
Happy (belated) Hacktoberfest!
The Docker check fails for a dependency issue, which isn't the fault here. So I'm merging it. |
Alright, thanks for letting me know, and thanks for the help! |
Because of the two ways to do it? Yeah, this happens. I think this works! |
What GitHub issue does this PR apply to?
Resolves #736
What changed and why?
As per my assigned issue, I've added Kotlin 1.5's input and output operations documentation.
Checklist
Any additional comments or things to be aware of while reviewing?
Kotlin docs were used in resolving this issue.
Code was researched as best I could, if there are any typos, mistakes, adjustments to comments or syntax fixing needed, please let me know.