Implicit type conversion: Difference between revisions

Applesoft BASIC
m (omit from assembly)
(Applesoft BASIC)
Line 123:
</pre>
 
=={{header|Applesoft BASIC}}==
There are 7 types: reals, integers, strings, defined functions, floating point arrays, integer arrays, and arrays of strings. Implicitly there are only floating point (real) and strings.
<lang gwbasic> 100 LET M$ = CHR$ (13)
110 PRINT M$"SIMPLE VARIABLES"M$
120 LET AB = 6728.0
130 PRINT "FLOATING POINT: ";AB
140 LET AB% = 6728.0
150 PRINT "INTEGER: ";AB%
160 LET AB$ = "HELLO"
170 PRINT "STRING: ";AB$
180 DEF FN AB(AB) = AB + 6728.0 - VAL (".")
190 PRINT "DEFINED FUNCTION: "; FN AB(0)
200 PRINT M$"ARRAY VARIABLES"M$
210 DIM AB(3,12,7)
220 LET AB(3,12,7) = 6728.0
230 PRINT "FLOATING POINT: ";AB(3,12,7)
240 DIM AB%(3,12,7)
250 LET AB%(3,12,7) = 6728.0
260 PRINT "INTEGER: ";AB%(3,12,7)
270 DIM AB$(3,12,7)
280 LET AB$(3,12,7) = "HELLO"
290 PRINT "STRING: ";AB$(3,12,7)
300 PRINT M$"TYPE CONVERSIONS"M$
310 LET AB$ = STR$(6728.0)
320 PRINT "REAL TO STRING CONVERSION: ";AB$
330 LET AB = VAL("6728.0")
340 PRINT "STRING TO REAL CONVERSION: ";AB</lang>
=={{header|AWK}}==
<lang AWK>
413

edits