You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To determine if a string is empty, you can check if the size is zero, or just use the shorthand String#empty?:
and later
The method String#blank? returns true if the string is empty or if it only contains whitespace characters. A related method is String#presence which returns nil if the string is blank, otherwise the string itself.
The # should be replaced with a . in each case.
The text was updated successfully, but these errors were encountered:
Actually, as I read further, I see consistent use of the # in the descriptions, and . in the interactive code examples... So, perhaps an explanation of why the text says "use ...#..." and then doesn't use "...#..." in the code examples.
(It's a beginners / basic tutorial, and stuff like that is confusing to beginners.)
String.empty? refers to a class method. The # is correct when used to refer to an instance method. This convention comes from Ruby; our docs should indeed be friendlier towards readers with no Ruby experience (crystal-lang/crystal#8377). The problem is, at this point the tutorial doesn't even introduce OOP concepts yet, so there isn't anything we can do here for now.
straight-shoota
changed the title
Bug: Small typo in basic tutorial on strings. (Easy fix.)
[basics] Introduce concepts for referencing methods in documentation
Dec 24, 2021
Bug Report
The tutorial on strings at https://crystal-lang.org/reference/1.2/tutorials/basics/40_strings.html reads:
and later
The
#
should be replaced with a.
in each case.The text was updated successfully, but these errors were encountered: