Is it appropriate to say that a function not having a return statement is valid?
HimaniBansal -6 Newbie Poster
Recommended Answers
Jump to PostMy background is in Smalltalk, so I can't understand the design decision to return None/void from a method/function that has no specific return value.
In Smalltalk a method with no explicit return wil always return the receiver object, which enables you to chain calls together like (pseudocode)
person.setName(etc).setAddress(etc).setDOB(etc).print()
Interestingly, Java …
Jump to PostYes, Smalltalk is totally OO, all it has are objects and messages. Blocks of code are just objects. The language doesn't even have loops or if tests - the same functionality is built with messages to Boolean objects, eg (pseudocode)
aBoolean.ifTrue(some code).ifFalse(some code)
oraBoolean.whileTrue(some code)
But I think thats …
All 5 Replies
Sheetal_1 0 Newbie Poster
vegaseat 1,735 DaniWeb's Hypocrite Team Colleague
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
vegaseat 1,735 DaniWeb's Hypocrite Team Colleague
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
griswolf commented: In Python an object may be used in a boolean expression, e.g. if object_value: +11
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.