ceylon--say more,more clearly ---(1) Basics



Let's get started!

让我们开始吧!

Before we can get into any of the really interesting and powerful features of this language, we need to get comfortable with some of the basic syntax, so we'll know what we're looking at later on, when we get up to the really good stuff.


print("Hello,World");
跨行
print("Hello,
        world"); 输出结果有空格,跨行。
如果 想在排版时跨行,但输出时不想有空格 可使用normalized来排版
value message= "Hello,
                              World";
print(message.normalized);//输出结果不在是第一次跨行时,有空格的情况,而是输出Hello,World.

(二)文档注释
/*注释方式1*/
//注释方式2
第三种方式,个人测试出错,未找到原因
doc("The classic Hello World program")
by("Trompon the Elephant")
see(`function goodbye`)
throws(`class IOException`)
shared void hello()
{
print("hello,world');
}
其他注释
""双引号注释,在文件第一行。
(三)转义字符
print("\"Hello!\",said the program ");
\,\n,\t,\\等

三个"""sdfsdfs"""
print(""""Hello1",said the program.""");

print("Hello ,this is Ceylon ``language.version``
        running on ``runtime.name``   ``runtime.version`` !\n
        you ran me at ``system.milliseconds`` ms,
        with ``process.arguments.size``   arguments.");
 print("Hello,this is Ceylon "+language.version +
       "running on " + runtime.name +"    '  + runtime.version +"!\n" +
       "You ran me at " + system.milliseconds.string  +
       "ms ,  with  " +process.arguments.size.string +
       "arguments.");


String name = process.arguments.first; //compile error: String? is not assignable to String
String greeting = "Hello, ``name``!";
print(greeting);

String? name 
        = process.arguments.first;
String greeting;
if (exists name) {
    greeting = "Hello, ``name``!";
}
else {
    greeting = "Hello, World!";
}
print(greeting);


String greeting;
if (exists name 
        = process.arguments.first) {
    greeting = "Hello, ``name``!";
}
else {
    greeting = "Hello, World!";
}
print(greeting);


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
UniApp 是一种基于 Vue.js 的跨平台应用开发框架,它可以让你用一套代码同时构建 Web、iOS、Android 等多个平台的应用。Cesium 是一款强大的开源 3D 地图引擎,常用于创建高度交互式的地球空间可视化应用程序。 要将 Cesium 引入到 UniApp 中,你需要按照以下步骤操作: 1. 安装依赖:首先,确保你的 UniApp 项目已经安装了 Vue CLI。然后,在 `npm` 或 `yarn` 包管理器中安装 Cesium 的 Vue 组件库,例如官方的 Cesium for Vue(如果有的话)或第三方封装的组件。命令可能类似这样: ```bash npm install @czml-viewer/czml-vue --save ``` 2. 引入库文件:在你的 Vue 文件(如 `main.vue` 或组件内)中,导入 Cesium 组件: ```html <template> <div id="app"> <czml-viewer ref="cesiumViewer"></czml-viewer> </div> </template> <script> import CesiumViewer from '@czml-viewer/czml-vue'; export default { components: { CesiumViewer }, // ... } </script> ``` 3. 初始化和配置:在 Vue 实例的 `mounted` 生命周期钩子中,初始化 Cesium Viewer,并配置地图和视图: ```js mounted() { this.$refs.cesiumViewer.initialize({ scene: { imageryProvider: new Cesium.CesiumIonImageryProvider({ url: 'https://assets.cesium.com/ceylon-blue/{z}/{x}/{y}.jpg' }), baseLayerPicker: false }, pickingOptions: { pickType: Cesium.PickType.POINT } }); }, ``` 4. 使用 CZML 格式的数据:Cesium支持 CZML (ColladaZ Markup Language) 格式来加载3D模型。你可以从后端获取 CZML 数据并在需要的地方展示。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值