Click here to Skip to main content
15,886,873 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: let, var, val - Swift, Kotlin, JavaScript Pin
kalberts13-Jun-19 6:44
kalberts13-Jun-19 6:44 
GeneralRe: let, var, val - Swift, Kotlin, JavaScript Pin
Member 916705717-Jun-19 20:42
Member 916705717-Jun-19 20:42 
GeneralRe: let, var, val - Swift, Kotlin, JavaScript Pin
kalberts17-Jun-19 23:09
kalberts17-Jun-19 23:09 
GeneralRe: let, var, val - Swift, Kotlin, JavaScript Pin
Member 916705718-Jun-19 0:10
Member 916705718-Jun-19 0:10 
GeneralRe: let, var, val - Swift, Kotlin, JavaScript Pin
Sander Rossel12-Jun-19 22:05
professionalSander Rossel12-Jun-19 22:05 
GeneralRe: let, var, val - Swift, Kotlin, JavaScript Pin
raddevus13-Jun-19 1:44
mvaraddevus13-Jun-19 1:44 
GeneralRe: let, var, val - Swift, Kotlin, JavaScript Pin
den2k8812-Jun-19 22:28
professionalden2k8812-Jun-19 22:28 
GeneralRe: let, var, val - Swift, Kotlin, JavaScript Pin
Richard Deeming12-Jun-19 23:34
mveRichard Deeming12-Jun-19 23:34 
VB6 and earlier needed Set and Let because of non-indexed default properties, which thankfully went away when .NET was first released.

For example:
VB
Dim rst As ADODB.Recordset
Set rst = ...

Dim foo As Variant 
foo = rst["Bar"]

  • The Recordset class doesn't have an indexer, but it has a default property called Fields which does.
  • The indexer returns an ADODB.Field object, with a non-indexed default property called Value.
  • At this point, the compiler wouldn't know whether you want the variable to contain the field object or the field's value.
  • Therefore you have to use Set if you want the field object, and Let (or nothing) if you want the value.

Fun times! Dead | X|



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

GeneralRe: let, var, val - Swift, Kotlin, JavaScript Pin
den2k8812-Jun-19 23:41
professionalden2k8812-Jun-19 23:41 
GeneralRe: let, var, val - Swift, Kotlin, JavaScript Pin
raddevus13-Jun-19 1:46
mvaraddevus13-Jun-19 1:46 
GeneralRe: let, var, val - Swift, Kotlin, JavaScript PinPopular
MSBassSinger13-Jun-19 5:23
professionalMSBassSinger13-Jun-19 5:23 
GeneralRe: let, var, val - Swift, Kotlin, JavaScript Pin
Maximilien17-Jun-19 8:10
Maximilien17-Jun-19 8:10 
GeneralRe: let, var, val - Swift, Kotlin, JavaScript Pin
raddevus18-Jun-19 2:00
mvaraddevus18-Jun-19 2:00 
GeneralMust-Have NuGet Constants Packages Pin
David A. Gray7-Jun-19 20:56
David A. Gray7-Jun-19 20:56 
GeneralKill it with fire #2 - or fml Pin
charlieg31-May-19 12:04
charlieg31-May-19 12:04 
GeneralRe: Kill it with fire #2 - or fml Pin
David O'Neil31-May-19 15:11
professionalDavid O'Neil31-May-19 15:11 
GeneralRe: Kill it with fire #2 - or fml Pin
Gary R. Wheeler31-May-19 16:38
Gary R. Wheeler31-May-19 16:38 
GeneralRe: Kill it with fire #2 - or fml Pin
David O'Neil31-May-19 17:34
professionalDavid O'Neil31-May-19 17:34 
GeneralRe: Kill it with fire #2 - or fml Pin
charlieg1-Jun-19 3:22
charlieg1-Jun-19 3:22 
GeneralRe: Kill it with fire #2 - or fml Pin
David O'Neil1-Jun-19 11:54
professionalDavid O'Neil1-Jun-19 11:54 
GeneralRe: Kill it with fire #2 - or fml Pin
charlieg1-Jun-19 17:43
charlieg1-Jun-19 17:43 
GeneralRe: Kill it with fire #2 - or fml Pin
Sander Rossel8-Jun-19 0:47
professionalSander Rossel8-Jun-19 0:47 
GeneralRe: Kill it with fire #2 - or fml Pin
David O'Neil8-Jun-19 5:49
professionalDavid O'Neil8-Jun-19 5:49 
GeneralRe: Kill it with fire #2 - or fml Pin
Rick York12-Jun-19 13:22
mveRick York12-Jun-19 13:22 
GeneralRe: Kill it with fire #2 - or fml Pin
Member 1388243212-Jun-19 20:31
Member 1388243212-Jun-19 20:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.