Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //loops
- //java
- /*
- for (int counter=0;counter<5;counter+=1)
- {
- System.out.printLn(counter);
- }
- */
- for counter in 1...5
- {
- // print (counter)
- }
- //giving other names for our variables (later on clousers)
- typealias neven=Int
- var names:[String] = ["Faiz","Ali","Jordan","Nick"]
- var userGrades:[String:neven] = ["Faiz":90,"Ali":95,"Jordan":98,"Nick":100]
- //foreach
- //type I
- for nameItem in names {
- print (nameItem)
- }
- //type II
- for name in userGrades{
- print ("student name:\(name.key)")
- }
- //type III
- for grade in userGrades.values{
- print (grade)
- }
- //type IV
- for idx in 90...100
- {
- print (idx)
- }
- //type V
- for _ in 1...5
- {
- print ("Kapara");
- }
- //while
- var x=0
- while (x<5){
- print ("kapara on neo")
- x += 1
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement