fork download
  1. uses java.io.InputStreamReader
  2. uses java.util.Scanner
  3. uses java.lang.System
  4.  
  5. var name: String = "Dids"
  6. var age: int = 55
  7. var height: double = 1.88
  8. var weight: double = 185.0 // Correct numeric value for weight in kg
  9.  
  10. print("Name: ${name}")
  11. print("Age: ${age}")
  12. print("Height: ${height}")
  13. print("Weight: ${weight}kg") // Add "kg" to the output
  14.  
  15. print("Hi ${name}, you are aged ${age} and have a height of ${height}m, also your approx weight is ${weight}kg.")
  16.  
  17. for(i in 1..10)
  18. {
  19. print("Number:these are the first 10 nubers in ascending order ${i}")
  20.  
  21. var name: String
  22. var age: int
  23.  
  24. construct(name: String, age: int){
  25. this.name =name
  26. this .age =age
  27.  
  28.  
  29. }
  30. var person = new person("David", 56)
  31. }
  32.  
Success #stdin #stdout #stderr 4.77s 174044KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
gw.lang.parser.exceptions.ParseResultsException: prog.gosu

Errors: 

Expecting '}' to close statement block. [line:31 col:1] in
line 30: 	var person = new person("David", 56)
line 31: }
line 32: 
Line Number: 31  Column: 1

name, is already defined. Please use a different name. [line:21 col:6] in
line 20: 	
line 21: 	var name: String
line 22: 	var age: int
Line Number: 21  Column: 6

age, is already defined. Please use a different name. [line:22 col:6] in
line 21: 	var name: String
line 22: 	var age: int
line 23: 	
Line Number: 22  Column: 6

Syntax error. [line:24 col:2] in
line 23: 	
line 24: 	construct(name: String, age: int){
line 25: 		this.name =name
Line Number: 24  Column: 2


	at gw.internal.gosu.parser.ParserBase.verifyParsedElement(ParserBase.java:292)
	at gw.internal.gosu.parser.ParserBase.verifyParsedElement(ParserBase.java:263)
	at gw.internal.gosu.parser.GosuClassParser.parseDefinitions(GosuClassParser.java:475)
	at gw.internal.gosu.parser.GosuClass.compileDefinitionsIfNeeded(GosuClass.java:1551)
	at gw.internal.gosu.parser.GosuClass.compileDefinitionsIfNeeded(GosuClass.java:1494)
	at gw.internal.gosu.parser.GosuClass.isValid(GosuClass.java:925)
	at gw.internal.gosu.parser.GosuProgram_Proxy.isValid(gw.internal.gosu.parser.GosuProgram_Proxy:2)
	at gw.internal.gosu.parser.GosuProgramParser.parseExpressionOrProgram(GosuProgramParser.java:229)
	at gw.lang.Gosu.runWithFile(Gosu.java:621)
	at gw.lang.Gosu.start(Gosu.java:140)
	at gw.lang.Gosu.main(Gosu.java:70)