Create Class and functions for student class


Hello Everybody I’m new in coding and I wanna share my practice with yours
I create class for student with two functions the first one string function return the name and city and school.
and second function return Int after test Degree of Student. my questions is.


It really depends on what you want to do with the code.

From the example you provide, this code does something, but I’m not really sure what it’s suppose to be doing to the end user.

I don’t understand how you’re trying to calculate grades or degree information.

  1. I would not use optional values for variables if they cannot be nil (not empty)
  2. Declare variables on separate lines (and you can paste code into the forum, instead of a tiny screenshot)

Share code

// you can indent code with 4 spaces
func calculateTestAverage() -> Double {
     return 50  // placeholder for actual logic ...