It's UWAweek 42 (2nd semester, week 12)

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 738 articles.
Currently 189 other people reading this forum.


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

Login to reply

👍?
helpful
6:05pm Sat 14th Sep, ANONYMOUS

In the code provided in sample02.ml, are the variables x and y considered local variables, or can they also be considered global variables? # An assignment statement, 2.500000 is printed x <- 2.5 y <- 5 print x print y Or are variables only considered global when there is a function present and it is declared outside & before the function, as in sample08.ml? # 9 is printed one <- 1 function increment value return value + one print increment(3) + increment(4)


SVG not supported

Login to reply

👍x1
helpful
10:43pm Sat 14th Sep, Joshua N.

ANONYMOUS wrote:
> In the code provided in sample02.ml, are the variables x and y considered local variables, or can they also be considered global variables? > > # An assignment statement, 2.500000 is printed > x <- 2.5 > y <- 5 > print x > print y > > Or are variables only considered global when there is a function present and it is declared outside & before the function, as in sample08.ml? > > # 9 is printed > > one <- 1 > > function increment value > return value + one > > print increment(3) + increment(4)
Hi, in both cases, the variables would be considered global since they are not located inside of a function.

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