Tutorialspoint

Forced Unwrapping Program

var myString:String?

myString = "Hello, Swift 4!"

if myString != nil {
   print( myString! )
} else {
   print("myString has nil value")
}

Forced Unwrapping

var myString:String?

myString = "Hello, Swift 4!"

if myString != nil {
   print(myString)
} else {
   print("myString has nil value")
}

Optionals

var myString:String? = nil

if myString != nil {
   print(myString)
} else {
   print("myString has nil value")
}

Printing Variables

var varA = "Godzilla"
var varB = 1000.00

print("Value of \(varA) is more than \(varB) millions")

Naming Variables

var _var = "Hello, Swift 4!"
print(_var)

var 你好 = "你好世界"
print(你好)

Type Annotations

var varA = 42
print(varA)

var varB:Float

varB = 3.14159
print(varB)

variable declaration

var varA = 42
print(varA)

sampleswiftprogram

/* My first program in Swift 4 */
var myString = "Hello, World!"
print(myString)

Ext.jsExt.tab.PanelContainer

<!DOCTYPE html>
<html>
   <head>
      <link href = "https://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/classic/theme-classic/resources/theme-classic-all.css" 
         rel = "stylesheet" />
      <script type = "text/javascript" 
         src = "https://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/ext-all.js"></script>
      
      <script type = "text/javascript">
         Ext.onReady(function () {
            Ext.create('Ext.tab.Panel', {
               renderTo: Ext.getBody(),
               height: 100,
               width: 200,
               
               items: [{
                  xtype: 'panel',
                  title: 'Tab One',
                  html: 'The first tab',
                  listeners: {
                     render: function() {
                        Ext.MessageBox.alert('Tab one', 'Tab One was clicked.');
                     }
                  }
               },{
                  // xtype for all Component configurations in a Container
                  title: 'Tab Two',
                  html: 'The second tab',
                  listeners: {
                     render: function() {
                        Ext.MessageBox.alert('Tab two', 'Tab Two was clicked.');
                     }
                  }
               }]
            });
         });
      </script>
   </head>
   
   <body>
   </body>
</html>

Ext.jsExt.tab.PanelContainer

<!DOCTYPE html>
<html>
   <head>
      <link href = "https://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/classic/theme-classic/resources/theme-classic-all.css" 
         rel = "stylesheet" />
      <script type = "text/javascript" 
         src = "https://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/ext-all.js"></script>
      
      <script type = "text/javascript">
         Ext.onReady(function () {
            Ext.create('Ext.tab.Panel', {
               renderTo: Ext.getBody(),
               height: 100,
               width: 200,
               
               items: [{
                  xtype: 'panel',
                  title: 'Tab One',
                  html: 'The first tab',
                  listeners: {
                     render: function() {
                        Ext.MessageBox.alert('Tab one', 'Tab One was clicked.');
                     }
                  }
               },{
                  // xtype for all Component configurations in a Container
                  title: 'Tab Two',
                  html: 'The second tab',
                  listeners: {
                     render: function() {
                        Ext.MessageBox.alert('Tab two', 'Tab Two was clicked.');
                     }
                  }
               }]
            });
         });
      </script>
   </head>
   
   <body>
   </body>
</html>

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.