Programming Course for Beginners - ZedLX

The Easiest Online Computer Programming Course, for Free

The Type string [6/14]

The getter .str (member of num) converts a number into a string.

Some other types also have a getter .str, for example the type int.

The expression -78 is of type int. The type int has a member .str. The expression (-78).str evaluates to value "-78" of type string. Then, a getter .n can be applied to the string "-78", resulting in the value 3 because the string "-78" has three characters. Therefore, the result of the expression (-78).str.n is the value 3.

Loading...