if (x = 1)
if var x = 1
if let x = 1 //let is const in C
var x = 1
var x: Int = 1
In swift you can doCode: [Select]if var x = 1I guess declaring a variable in the condition would be an automatic true?
if( int x = 1 )
Oh btw, the datatype on variables are assumed
Code: [Select]if( int x = 1 )Dunno about swift, however, C++ will return false if 0 was assigned.
IMHO that should not be considered an error at all (I mean in the "C world"). I mean, it's legal even it's not logic. Who would have to know if an assignement has been done or not? In the other hand, who would have to do an assignement in an equality testing?Why did they use two different symbols?