It's UWAweek 47

help2002

This forum is provided to promote discussion amongst students enrolled in CITS2002 Systems Programming.
Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.
Displaying the 2 articles in this topic
Showing 2 of 828 articles.
Currently 96 other people reading this forum.


 UWA week 36 (2nd semester, mid-semester break) ↓
SVG not supported

Login to reply

👍x1
helpful
1:54pm Wed 4th Sep, Daniel J.

The description of ML allows for functions to have no return statements. If I have a function like:

function noreturn a b
    print a + b

print 1 + noreturn(1, 2)

Obviously the inner print will print 3, but what about the outer print? Is it expected that functions with no return implicitly return 0?

Or is it a syntax error to try and perform the + operation between a number and effectively void?


 UWA week 37 (2nd semester, week 7) ↓
SVG not supported

Login to reply

👍?
helpful
8:38pm Wed 11th Sep, Joshua N.

"Daniel Jones" [email protected] wrote:

The description of ML allows for functions to have no return statements. If I have a function like:

function noreturn a b
    print a + b

print 1 + noreturn(1, 2)

Obviously the inner print will print 3, but what about the outer print? Is it expected that functions with no return implicitly return 0?

Or is it a syntax error to try and perform the + operation between a number and effectively void?

I would say it works as it does in c, and would return 0, so the outer print would return 1.

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  8:08AM Aug 25 2024
Privacy policy