Post

Replies

Boosts

Views

Activity

Expressions are not allowed at the top level
HI I haven't coded in a long time and I don't know how to use CodeX and now I can't move on from here, I don't know how to put the code in the right place in the code. :( import SwiftUI struct ContentView: View { var body: some View { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) Text("Hello, world!") } .padding() } } #Preview { ContentView() } let range01INT1 = 100000 ... 199999 print("Range:",range01INT1,"Number of numbers", range01INT1.count) Print command give me a error let range01INT1 = 100000 ... 199999 print("Range:",range01INT1,"Number of numbers", range01INT1.count) Expressions are not allowed at the top level I know it's a stupid question, but I just can't get started.
3
0
691
Feb ’24
How to print number, which missing between ranges?
import Foundation print("Xcode Swift") // create some ranges let Range1 = 1 ... 10 let Range2 = 14 ... 22 let Range3 = 26 ... 30 let Range4 = 40 ... 44 let Range5 = 50 ... 60 print("Range1 SUM:",Range1.count) print("Range2 SUM:",Range2.count) print("Range3 SUM:",Range3.count) print("Range4 SUM:",Range4.count) print("Range5 SUM:",Range5.count) // Count the ranges together from Range2 to Range4 let RangeBetween = Range2.count + Range3.count + Range4.count // print the number of values print("SUM: From Range2 to Range4:",RangeBetween) //How to print number, which missing between ranges? I should find the missing numbers between the series, how is that possible?
8
0
763
Jan ’23
From range1 to range4
how do I add range2+range 3+range4 more conveniently, I add the series together now one by one. import Foundation print("Xcode Swift") // create some ranges let range1 = 1 ... 10 let range2 = 2 ... 10 let range3 = 3 ... 10 let range4 = 4 ... 10 let range5 = 5 ... 10 // Count the ranges together from range2 to range4 let range6 = range2.count + range3.count + range4.count // print the number of values print(range6)
7
0
1.2k
Jan ’23