[Phix] ? operator; string behavior

new topic     » topic index » view thread      » older message » newer message

In Phix, the ability of question_mark ? being able to output text and numbers is really handy:

Statement Phix output OE output
? 'A' 65 65
? 'A' + 32 97 97
? 'A' & 'a' "Aa" {65,97}
? 65 & 97 "Aa" {65,97}
? 65 65 65
? {65} {65} {65}
? "A" "A" {65}
? "A" + 32 "a" 97
? {65} + 32 {97} {97}
? 65 + 32 97 97
? 65 & 97 "Aa" {65,97}

In Phix, single_quote ' delimiters sometimes make a number and sometimes a character. Any sometimes syntax is disturbing.

Phix

 
object x = { 'h','e','l','l','o' } 
? x 
puts(1, x) 
printf(1, "%s", {x} ) 
 
/* 

{104,101,108,108,111} 
ello?helloPress any key... 
*/ 
  • The 'h' is not output using the ? operator.
  • And, where does the extra '?' come from?

_tom

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu