Can you replace let in Swift with const?

That let keyword in Swift keeps bothering me - can we change it to const?

not really
let is runtime constness - once assigned its “const”
const is compile time

It just seems so stupid to abbreviate a variable to var and then not to abbreviate a constant to const - whoever thought of using let is a sadist … :rage:

whoever thought of using let is a sadist … :rage:

They just wanted to confuse old time BASIC programmers that use Let for variable assignments! :wink:

In Swift const and let behave differently :slight_smile:

const is always const - always and forever

let is more “within the scope where this thing was created you CANNOT alter it”

Xojo doesnt have this notion of “const” parameters so unless you know a language that does its hard to explain

1 Like

Swift does not have the keyword CONST

and LET is kinda const. You cannot redefine it value (as you can with a variable). but if the LET value is an object… you CAN sometimes assign values to its properties