Jump to content

Deepcopy: Difference between revisions

1,285 bytes added ,  7 months ago
Initial FutureBasic task solution added
(→‎Insitux: implementation)
(Initial FutureBasic task solution added)
Line 771:
</pre>
 
=={{header|FutureBasic}}==
Translation of FreeBasic
<syntaxhighlight lang="futurebasic">
include "NSLog.incl"
 
begin record DeepCopy
NSInteger value1
CFStringRef value2
CFStringRef value3
Boolean value4
double value5
end record
 
local fn DoDeepCopy
DeepCopy a, b
a.value1 = 10
a.value2 = @"A"
a.value3 = @"Okay"
a.value4 = YES
a.value5 = 1.985766472453666
b = a
b.value1 = 20
b.value2 = @"B"
b.value3 = @"Not Okay"
b.value4 = NO
b.value5 = 3.148556644245367
NSLog( @"\nValue of 'a':" )
NSLog( @"a.value1: %ld", a.value1 )
NSLog( @"a.value2: %@", a.value2 )
NSLog( @"a.value3: %@%", a.value3 )
NSLog( @"b.value4: %@", fn BoolString( a.value4 ) )
NSLog( @"a.value5: %.15f", a.value5 )
NSLog( @"\nValue of 'b':" )
NSLog( @"b.value1: %ld", b.value1 )
NSLog( @"b.value2: %@", b.value2 )
NSLog( @"b.value3: %@%", b.value3 )
NSLog( @"b.value4: %@", fn BoolString( b.value4 ) )
NSLog( @"b.value5: %.15f", b.value5 )
end fn
 
fn DoDeepCopy
 
HandleEvents
</syntaxhighlight>
{{output}}
<pre>
Value of 'a':
a.value1: 10
a.value2: A
a.value3: Okay
b.value4: YES
a.value5: 1.985766472453666
 
Value of 'b':
b.value1: 20
b.value2: B
b.value3: Not Okay
b.value4: NO
b.value5: 3.148556644245367
 
</pre>
 
=={{header|Go}}==
721

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.