+ 1
Should b not be let?
Variable b should be made a constant since it never changes Hence let b = value Alternatively the answer should accept both let and var in the declaration of b.
7 ответов
+ 1
in what context?! 😅😅
+ 1
did the question not attach the quiz?
+ 1
The question asked something similar to
+ 1
swift
+ 1
var a = 10
__ b = 30
let sum = a + b
print(sum)
+ 1
the question asked to fill in the blank but wouldnt accept let as an answer
+ 1
If that was your only code, your version would work since 30 is the only number b is. However, this code is meant to be reusable as you will see if you continue in Swift. Other parts of the program would be able to change "b" and return a different sum (the whole point in using variables). B should be a var. Otherwise you may as well just type: print(10 + 30) or even just print(40)